diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-07-06 15:29:02 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-07-06 15:59:35 +0200 |
| commit | 36db93ffb999fa743fc81cf9d05811b94751ca5f (patch) | |
| tree | 17ed11d544e3735eaaadfa589998766372b853bb /pkg | |
| parent | 4e3820bfb2ea2331d420033ae77d341ed049c2a5 (diff) | |
pkg/osutil: remove appengine tag
Appengine doesn't provide appengine tag anymore.
Resort to use of syscall package for ExitStatus instead.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/osutil/osutil.go | 9 | ||||
| -rw-r--r-- | pkg/osutil/osutil_akaros.go | 2 | ||||
| -rw-r--r-- | pkg/osutil/osutil_appengine.go | 31 | ||||
| -rw-r--r-- | pkg/osutil/osutil_bsd.go | 2 | ||||
| -rw-r--r-- | pkg/osutil/osutil_darwin.go | 2 | ||||
| -rw-r--r-- | pkg/osutil/osutil_fuchsia.go | 2 | ||||
| -rw-r--r-- | pkg/osutil/osutil_linux.go | 2 | ||||
| -rw-r--r-- | pkg/osutil/osutil_noappengine.go | 17 | ||||
| -rw-r--r-- | pkg/osutil/osutil_unix.go | 2 | ||||
| -rw-r--r-- | pkg/osutil/osutil_windows.go | 2 |
10 files changed, 12 insertions, 59 deletions
diff --git a/pkg/osutil/osutil.go b/pkg/osutil/osutil.go index 6a59a9857..47fcc8b7b 100644 --- a/pkg/osutil/osutil.go +++ b/pkg/osutil/osutil.go @@ -10,6 +10,7 @@ import ( "os" "os/exec" "path/filepath" + "syscall" "time" ) @@ -61,10 +62,16 @@ func Run(timeout time.Duration, cmd *exec.Cmd) ([]byte, error) { if <-timedout { text = fmt.Sprintf("timedout %q", cmd.Args) } + exitCode := 0 + if exitErr, ok := err.(*exec.ExitError); ok { + if status, ok := exitErr.Sys().(syscall.WaitStatus); ok { + exitCode = status.ExitStatus() + } + } return output.Bytes(), &VerboseError{ Title: text, Output: output.Bytes(), - ExitCode: exitCode(err), + ExitCode: exitCode, } } return output.Bytes(), nil diff --git a/pkg/osutil/osutil_akaros.go b/pkg/osutil/osutil_akaros.go index bc5b68b6a..d1001a37e 100644 --- a/pkg/osutil/osutil_akaros.go +++ b/pkg/osutil/osutil_akaros.go @@ -1,7 +1,7 @@ // Copyright 2017 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 akaros,!appengine +// +build akaros package osutil diff --git a/pkg/osutil/osutil_appengine.go b/pkg/osutil/osutil_appengine.go deleted file mode 100644 index 774866eee..000000000 --- a/pkg/osutil/osutil_appengine.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 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 Sandbox(cmd *exec.Cmd, user, net bool) error { - return nil -} - -func SandboxChown(file string) error { - return nil -} - -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_bsd.go b/pkg/osutil/osutil_bsd.go index bf97ae73b..68bcfa415 100644 --- a/pkg/osutil/osutil_bsd.go +++ b/pkg/osutil/osutil_bsd.go @@ -1,7 +1,7 @@ // Copyright 2017 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 freebsd,!appengine netbsd,!appengine openbsd,!appengine +// +build freebsd netbsd openbsd package osutil diff --git a/pkg/osutil/osutil_darwin.go b/pkg/osutil/osutil_darwin.go index 68cd81da6..016e692f7 100644 --- a/pkg/osutil/osutil_darwin.go +++ b/pkg/osutil/osutil_darwin.go @@ -1,8 +1,6 @@ // Copyright 2017 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 ( diff --git a/pkg/osutil/osutil_fuchsia.go b/pkg/osutil/osutil_fuchsia.go index 6ef2b08b2..31d5ca419 100644 --- a/pkg/osutil/osutil_fuchsia.go +++ b/pkg/osutil/osutil_fuchsia.go @@ -1,7 +1,7 @@ // Copyright 2017 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 fuchsia,!appengine +// +build fuchsia package osutil diff --git a/pkg/osutil/osutil_linux.go b/pkg/osutil/osutil_linux.go index 7ed109662..30fa892d8 100644 --- a/pkg/osutil/osutil_linux.go +++ b/pkg/osutil/osutil_linux.go @@ -1,8 +1,6 @@ // Copyright 2017 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 ( diff --git a/pkg/osutil/osutil_noappengine.go b/pkg/osutil/osutil_noappengine.go deleted file mode 100644 index 4c822db5b..000000000 --- a/pkg/osutil/osutil_noappengine.go +++ /dev/null @@ -1,17 +0,0 @@ -// 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 -} diff --git a/pkg/osutil/osutil_unix.go b/pkg/osutil/osutil_unix.go index 914398c79..3ab025e1a 100644 --- a/pkg/osutil/osutil_unix.go +++ b/pkg/osutil/osutil_unix.go @@ -1,7 +1,7 @@ // Copyright 2017 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 freebsd,!appengine netbsd,!appengine openbsd,!appengine linux,!appengine darwin,!appengine +// +build freebsd netbsd openbsd linux darwin package osutil diff --git a/pkg/osutil/osutil_windows.go b/pkg/osutil/osutil_windows.go index d98a9d33c..21649a8c3 100644 --- a/pkg/osutil/osutil_windows.go +++ b/pkg/osutil/osutil_windows.go @@ -1,8 +1,6 @@ // Copyright 2017 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 ( |
