mirror of
https://github.com/golang/go.git
synced 2024-09-21 10:28:27 +00:00
cmd/cgo: report exec errors a bit more clearly
Change-Id: I0e6bebf0e2e6efdef4be880e0c6c7451b938924b Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949417 Reviewed-by: Katie Hockman <katiehockman@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/284781 Run-TryBot: Roland Shoemaker <roland@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Roland Shoemaker <roland@golang.org>
This commit is contained in:
parent
46e2e2e9d9
commit
5a8a2265fb
@ -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()
|
||||
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user