diff options
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/osutil/osutil.go | 6 | ||||
| -rw-r--r-- | pkg/osutil/osutil_appengine.go | 7 | ||||
| -rw-r--r-- | pkg/osutil/osutil_noappengine.go | 17 |
3 files changed, 25 insertions, 5 deletions
diff --git a/pkg/osutil/osutil.go b/pkg/osutil/osutil.go index 4575809e1..6a59a9857 100644 --- a/pkg/osutil/osutil.go +++ b/pkg/osutil/osutil.go @@ -61,14 +61,10 @@ 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(), - ExitCode: exitCode, + ExitCode: exitCode(err), } } return output.Bytes(), nil diff --git a/pkg/osutil/osutil_appengine.go b/pkg/osutil/osutil_appengine.go index 6c3888dbf..774866eee 100644 --- a/pkg/osutil/osutil_appengine.go +++ b/pkg/osutil/osutil_appengine.go @@ -22,3 +22,10 @@ func setPdeathsig(cmd *exec.Cmd) { func killPgroup(cmd *exec.Cmd) { } + +func exitCode(err error) int { + // We are stuck on Go 1.11 on appengine. + // 1.11 does not have ProcessState.ExitCode. + // Once we upgrade to 1.12, we should remove this. + return 0 +} diff --git a/pkg/osutil/osutil_noappengine.go b/pkg/osutil/osutil_noappengine.go new file mode 100644 index 000000000..4c822db5b --- /dev/null +++ b/pkg/osutil/osutil_noappengine.go @@ -0,0 +1,17 @@ +// Copyright 2020 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +// +build !appengine + +package osutil + +import ( + "os/exec" +) + +func exitCode(err error) int { + if exitError, ok := err.(*exec.ExitError); ok { + return exitError.ProcessState.ExitCode() + } + return 0 +} |
