From 5707a3421857a7723210a9ffe42744ec0bb697a3 Mon Sep 17 00:00:00 2001 From: Davis Goodin Date: Wed, 12 May 2021 14:20:54 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Daniel Nephin --- testjson/execution.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testjson/execution.go b/testjson/execution.go index d8d774cc..eaea5874 100644 --- a/testjson/execution.go +++ b/testjson/execution.go @@ -591,8 +591,8 @@ type ScanConfig struct { Execution *Execution // Stop is called when ScanTestOutput fails during a scan. Stop func() - // IgnoreNonJSONOutputLines causes ScanTestOutput to print non-JSON lines to - // stderr rather than returning an error. + // IgnoreNonJSONOutputLines causes ScanTestOutput to ignore non-JSON lines received from + // the Stdout reader. Instead of causing an error, the lines will be sent to Handler.Err. IgnoreNonJSONOutputLines bool } @@ -667,7 +667,8 @@ func readStdout(config ScanConfig, execution *Execution) error { continue case err != nil: if config.IgnoreNonJSONOutputLines { - fmt.Fprintf(os.Stderr, "%s\n", raw) + // nolint: errcheck + config.Handler.Err(string(raw)) continue } return errors.Wrapf(err, "failed to parse test output: %s", string(raw))