1
0
mirror of https://github.com/golang/go synced 2024-09-29 17:24:34 -06:00

cmd/dist: forward stderr if 'go env CGO_ENABLED' fails

The default error string for a command failure is just its status code,
and "exit status 1" is not at all helpful for debugging.

Change-Id: I822c89bcc9e73283b33e01792bf9c40b1add3c35
Reviewed-on: https://go-review.googlesource.com/c/go/+/222308
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
Bryan C. Mills 2020-03-06 14:32:26 -05:00
parent 5ea58c6346
commit 1d90e1a0ac

View File

@ -98,9 +98,11 @@ func (t *tester) run() {
os.Setenv("PATH", fmt.Sprintf("%s%c%s", gobin, os.PathListSeparator, os.Getenv("PATH")))
}
slurp, err := exec.Command("go", "env", "CGO_ENABLED").Output()
cmd := exec.Command("go", "env", "CGO_ENABLED")
cmd.Stderr = new(bytes.Buffer)
slurp, err := cmd.Output()
if err != nil {
fatalf("Error running go env CGO_ENABLED: %v", err)
fatalf("Error running go env CGO_ENABLED: %v\n%s", err, cmd.Stderr)
}
t.cgoEnabled, _ = strconv.ParseBool(strings.TrimSpace(string(slurp)))
if flag.NArg() > 0 && t.runRxStr != "" {