os/exec: pass ExitCode tests on Plan 9

Fixes #27294

Change-Id: I8db5ca0f0c690bf532d3d33b8ed7d2633ad1702b
Reviewed-on: https://go-review.googlesource.com/131855
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Fazlul Shahriar 2018-08-28 09:55:43 -04:00 committed by Brad Fitzpatrick
parent 975f1afd85
commit 2e234754d7
1 changed files with 9 additions and 0 deletions

View File

@ -173,6 +173,9 @@ func TestExitCode(t *testing.T) {
cmd := helperCommand(t, "exit", "42")
cmd.Run()
want := 42
if runtime.GOOS == "plan9" {
want = 1
}
got := cmd.ProcessState.ExitCode()
if want != got {
t.Errorf("ExitCode got %d, want %d", got, want)
@ -181,6 +184,9 @@ func TestExitCode(t *testing.T) {
cmd = helperCommand(t, "/no-exist-executable")
cmd.Run()
want = 2
if runtime.GOOS == "plan9" {
want = 1
}
got = cmd.ProcessState.ExitCode()
if want != got {
t.Errorf("ExitCode got %d, want %d", got, want)
@ -189,6 +195,9 @@ func TestExitCode(t *testing.T) {
cmd = helperCommand(t, "exit", "255")
cmd.Run()
want = 255
if runtime.GOOS == "plan9" {
want = 1
}
got = cmd.ProcessState.ExitCode()
if want != got {
t.Errorf("ExitCode got %d, want %d", got, want)