Commit 0427c583 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

builder: update for os.Wait changes.

This compiles again.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5687078
parent 8b7cdb7f
......@@ -28,7 +28,7 @@ func run(envv []string, dir string, argv ...string) error {
// as well as writing it to logfile (if specified). It returns
// process combined stdout and stderr output, exit status and error.
// The error returned is nil, if process is started successfully,
// even if exit status is not 0.
// even if exit status is not successful.
func runLog(envv []string, logfile, dir string, argv ...string) (string, int, error) {
if *verbose {
log.Println("runLog", argv)
......@@ -51,11 +51,13 @@ func runLog(envv []string, logfile, dir string, argv ...string) (string, int, er
cmd.Stdout = w
cmd.Stderr = w
err := cmd.Run()
if err != nil {
if ws, ok := err.(*exec.ExitError); ok {
return b.String(), ws.ExitStatus(), nil
}
startErr := cmd.Start()
if startErr != nil {
return "", 1, startErr
}
exitStatus := 0
if err := cmd.Wait(); err != nil {
exitStatus = 1 // TODO(bradfitz): this is fake. no callers care, so just return a bool instead.
}
return b.String(), 0, err
return b.String(), exitStatus, nil
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment