Skip to content

Commit

Permalink
cmd/cgo: report exec errors a bit more clearly
Browse files Browse the repository at this point in the history
Change-Id: I0e6bebf0e2e6efdef4be880e0c6c7451b938924b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949417
Reviewed-by: Katie Hockman <[email protected]>
Reviewed-by: Jay Conrod <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-on: https://go-review.googlesource.com/c/go/+/284781
Run-TryBot: Roland Shoemaker <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Trust: Roland Shoemaker <[email protected]>
  • Loading branch information
rsc authored and rolandshoemaker committed Jan 21, 2021
1 parent 46e2e2e commit 5a8a226
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/cgo/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func run(stdin []byte, argv []string) (stdout, stderr []byte, ok bool) {
p.Env = append(os.Environ(), "TERM=dumb")
err := p.Run()
if _, ok := err.(*exec.ExitError); err != nil && !ok {
fatalf("%s", err)
fatalf("exec %s: %s", argv[0], err)
}
ok = p.ProcessState.Success()
stdout, stderr = bout.Bytes(), berr.Bytes()
Expand All @@ -88,7 +88,7 @@ func fatalf(msg string, args ...interface{}) {
// If we've already printed other errors, they might have
// caused the fatal condition. Assume they're enough.
if nerrors == 0 {
fmt.Fprintf(os.Stderr, msg+"\n", args...)
fmt.Fprintf(os.Stderr, "cgo: "+msg+"\n", args...)
}
os.Exit(2)
}
Expand Down

0 comments on commit 5a8a226

Please sign in to comment.