]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: report exec errors a bit more clearly
authorRuss Cox <rsc@golang.org>
Mon, 11 Jan 2021 15:01:24 +0000 (10:01 -0500)
committerRoland Shoemaker <roland@golang.org>
Thu, 21 Jan 2021 19:08:52 +0000 (19:08 +0000)
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>

src/cmd/cgo/util.go

index 921306b7aabf653c5d60c04aaee505c8d86bb75d..779f7be2259b3750166b6edce318adb779e7a3a6 100644 (file)
@@ -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)
 }