aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/osutil
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-06-25 18:36:11 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-07-02 10:56:05 +0200
commit1640a9d5285f3a31cf48f6ed1972324a2ca34c41 (patch)
tree6c546e30ae16d4bfea0d3eaeb797e5a53240379a /pkg/osutil
parent31792dba469d18a6564f79176f133ef1f42ede73 (diff)
pkg/bisect: minor style fix ups
Diffstat (limited to 'pkg/osutil')
-rw-r--r--pkg/osutil/osutil.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/pkg/osutil/osutil.go b/pkg/osutil/osutil.go
index 0bc257e76..4575809e1 100644
--- a/pkg/osutil/osutil.go
+++ b/pkg/osutil/osutil.go
@@ -61,9 +61,14 @@ func Run(timeout time.Duration, cmd *exec.Cmd) ([]byte, error) {
if <-timedout {
text = fmt.Sprintf("timedout %q", cmd.Args)
}
+ exitCode := 0
+ if exitError, ok := err.(*exec.ExitError); ok {
+ exitCode = exitError.ProcessState.ExitCode()
+ }
return output.Bytes(), &VerboseError{
- Title: text,
- Output: output.Bytes(),
+ Title: text,
+ Output: output.Bytes(),
+ ExitCode: exitCode,
}
}
return output.Bytes(), nil
@@ -77,8 +82,9 @@ func Command(bin string, args ...string) *exec.Cmd {
}
type VerboseError struct {
- Title string
- Output []byte
+ Title string
+ Output []byte
+ ExitCode int
}
func (err *VerboseError) Error() string {