diff --git a/cautils/display.go b/cautils/display.go index 155124d1..3e37a42b 100644 --- a/cautils/display.go +++ b/cautils/display.go @@ -35,15 +35,15 @@ func ScanStartDisplay() { if IsSilent() { return } - InfoDisplay(os.Stdout, "ARMO security scanner starting\n") + InfoDisplay(os.Stderr, "ARMO security scanner starting\n") } func SuccessTextDisplay(str string) { if IsSilent() { return } - SuccessDisplay(os.Stdout, "[success] ") - SimpleDisplay(os.Stdout, fmt.Sprintf("%s\n", str)) + SuccessDisplay(os.Stderr, "[success] ") + SimpleDisplay(os.Stderr, fmt.Sprintf("%s\n", str)) } @@ -60,8 +60,8 @@ func ProgressTextDisplay(str string) { if IsSilent() { return } - InfoDisplay(os.Stdout, "[progress] ") - SimpleDisplay(os.Stdout, fmt.Sprintf("%s\n", str)) + InfoDisplay(os.Stderr, "[progress] ") + SimpleDisplay(os.Stderr, fmt.Sprintf("%s\n", str)) } func StartSpinner() { diff --git a/cautils/versioncheck.go b/cautils/versioncheck.go index aaa72795..22f88c83 100644 --- a/cautils/versioncheck.go +++ b/cautils/versioncheck.go @@ -22,7 +22,7 @@ type IVersionCheckHandler interface { func NewIVersionCheckHandler() IVersionCheckHandler { if BuildNumber == "" { - WarningDisplay(os.Stdout, "Warning: unknown build number, this might affect your scan results. Please make sure you are updated to latest version.\n") + WarningDisplay(os.Stderr, "Warning: unknown build number, this might affect your scan results. Please make sure you are updated to latest version.\n") } if v, ok := os.LookupEnv(SKIP_VERSION_CHECK); ok && pkgutils.StringToBool(v) { return NewVersionCheckHandlerMock() diff --git a/resultshandling/printer/jsonprinter.go b/resultshandling/printer/jsonprinter.go index 7f2cc8a5..f6edd2ba 100644 --- a/resultshandling/printer/jsonprinter.go +++ b/resultshandling/printer/jsonprinter.go @@ -21,7 +21,7 @@ func (jsonPrinter *JsonPrinter) SetWriter(outputFile string) { } func (jsonPrinter *JsonPrinter) Score(score float32) { - fmt.Printf("\nOverall risk-score (0- Excellent, 100- All failed): %d\n", int(score)) + fmt.Fprintf(os.Stderr, "\nOverall risk-score (0- Excellent, 100- All failed): %d\n", int(score)) } func (jsonPrinter *JsonPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj) { diff --git a/resultshandling/printer/junit.go b/resultshandling/printer/junit.go index d7648a2d..2401ef13 100644 --- a/resultshandling/printer/junit.go +++ b/resultshandling/printer/junit.go @@ -22,7 +22,7 @@ func (junitPrinter *JunitPrinter) SetWriter(outputFile string) { } func (junitPrinter *JunitPrinter) Score(score float32) { - fmt.Printf("\nOverall risk-score (0- Excellent, 100- All failed): %d\n", int(score)) + fmt.Fprintf(os.Stderr, "\nOverall risk-score (0- Excellent, 100- All failed): %d\n", int(score)) } func (junitPrinter *JunitPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj) { diff --git a/resultshandling/reporter/mockreporter.go b/resultshandling/reporter/mockreporter.go index 22983fef..803066a6 100644 --- a/resultshandling/reporter/mockreporter.go +++ b/resultshandling/reporter/mockreporter.go @@ -26,5 +26,5 @@ func (reportMock *ReportMock) SetClusterName(clusterName string) { func (reportMock *ReportMock) DisplayReportURL() { message := fmt.Sprintf("\nYou can see the results in a user-friendly UI, choose your preferred compliance framework, check risk results history and trends, manage exceptions, get remediation recommendations and much more by registering here: https://%s/cli-signup \n", getter.GetArmoAPIConnector().GetFrontendURL()) - cautils.InfoTextDisplay(os.Stdout, fmt.Sprintf("\n%s\n", message)) + cautils.InfoTextDisplay(os.Stderr, fmt.Sprintf("\n%s\n", message)) } diff --git a/resultshandling/reporter/reporteventreceiver.go b/resultshandling/reporter/reporteventreceiver.go index 95b70f9c..fc090e42 100644 --- a/resultshandling/reporter/reporteventreceiver.go +++ b/resultshandling/reporter/reporteventreceiver.go @@ -130,7 +130,7 @@ func (report *ReportEventReceiver) DisplayReportURL() { u.Host = getter.GetArmoAPIConnector().GetFrontendURL() if report.customerAdminEMail != "" { - cautils.InfoTextDisplay(os.Stdout, fmt.Sprintf("\n\n%s %s/risk/%s\n(Account: %s)\n\n", message, u.String(), report.clusterName, report.customerGUID)) + cautils.InfoTextDisplay(os.Stderr, fmt.Sprintf("\n\n%s %s/risk/%s\n(Account: %s)\n\n", message, u.String(), report.clusterName, report.customerGUID)) return } u.Path = "account/sign-up" @@ -139,5 +139,5 @@ func (report *ReportEventReceiver) DisplayReportURL() { q.Add("customerGUID", report.customerGUID) u.RawQuery = q.Encode() - cautils.InfoTextDisplay(os.Stdout, fmt.Sprintf("\n\n%s %s\n\n", message, u.String())) + cautils.InfoTextDisplay(os.Stderr, fmt.Sprintf("\n\n%s %s\n\n", message, u.String())) }