diff options
Diffstat (limited to 'src/cmd/cgo/util.go')
-rw-r--r-- | src/cmd/cgo/util.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cmd/cgo/util.go b/src/cmd/cgo/util.go index 8a778418d..cd7cde2b6 100644 --- a/src/cmd/cgo/util.go +++ b/src/cmd/cgo/util.go @@ -56,17 +56,25 @@ func run(stdin []byte, argv []string) (stdout, stderr []byte, ok bool) { <-c <-c - w, err := p.Wait(0) + state, err := p.Wait() if err != nil { fatalf("%s", err) } - ok = w.Exited() && w.ExitStatus() == 0 + ok = state.Success() return } +func lineno(pos token.Pos) string { + return fset.Position(pos).String() +} + // Die with an error message. func fatalf(msg string, args ...interface{}) { - fmt.Fprintf(os.Stderr, msg+"\n", args...) + // 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...) + } os.Exit(2) } |