Skip to content

Commit

Permalink
Redirecting all stdout of subcommands to stderr (#2656)
Browse files Browse the repository at this point in the history
go tool compile writes syntax errors to stdout, including the one reported in #2592. Meanwhile, all regular output of subcommands should have been written to files. We should direct all stdout of subcommands to stderr, so we can find all errors in stderr. This mirrors behavior in the go command
  • Loading branch information
linzhp authored and Jay Conrod committed Sep 22, 2020
1 parent fab3573 commit e04f573
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion go/tools/builders/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ func (e *env) goCmd(cmd string, args ...string) []string {
// environment from this process.
func (e *env) runCommand(args []string) error {
cmd := exec.Command(args[0], args[1:]...)
cmd.Stdout = os.Stdout
// Redirecting stdout to stderr. This mirrors behavior in the go command:
// https://go.googlesource.com/go/+/refs/tags/go1.15.2/src/cmd/go/internal/work/exec.go#1958
cmd.Stdout = os.Stderr
cmd.Stderr = os.Stderr
return runAndLogCommand(cmd, e.verbose)
}
Expand Down

0 comments on commit e04f573

Please sign in to comment.