From 1640a9d5285f3a31cf48f6ed1972324a2ca34c41 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 25 Jun 2020 18:36:11 +0200 Subject: pkg/bisect: minor style fix ups --- pkg/osutil/osutil.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'pkg/osutil') 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 { -- cgit mrf-deployment