Skip to content

Commit

Permalink
Fix order of operations in readStderr
Browse files Browse the repository at this point in the history
When go module outline linse are encountered they should be
printed to stderr, but not counted as errors.

Also remove error return when errHandler fails. We should
continue to record errors in the execution type.
  • Loading branch information
dnephin committed Nov 3, 2018
1 parent 625b21f commit b64d455
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions testjson/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,23 +317,19 @@ func readStderr(in io.Reader, handle errHandler, exec *Execution) chan error {
defer close(wait)
scanner := bufio.NewScanner(in)
for scanner.Scan() {
// TODO: remove this check if go module events stop being output as stdErr
if checkIsGoModuleEvent(scanner.Text()) {
line := scanner.Text()
handle(line)
if isGoModuleOutput(line) {
continue
}

exec.addError(scanner.Text())
if err := handle(scanner.Text()); err != nil {
wait <- err
return
}
exec.addError(line)
}
wait <- scanner.Err()
}()
return wait
}

func checkIsGoModuleEvent(scannerText string) bool {
func isGoModuleOutput(scannerText string) bool {
prefixes := [2]string{"go: extracting", "go: downloading"}

for _, prefix := range prefixes {
Expand Down

0 comments on commit b64d455

Please sign in to comment.