Commit 2e234754 authored by Fazlul Shahriar's avatar Fazlul Shahriar Committed by Brad Fitzpatrick

os/exec: pass ExitCode tests on Plan 9

Fixes #27294

Change-Id: I8db5ca0f0c690bf532d3d33b8ed7d2633ad1702b
Reviewed-on: https://go-review.googlesource.com/131855Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 975f1afd
...@@ -173,6 +173,9 @@ func TestExitCode(t *testing.T) { ...@@ -173,6 +173,9 @@ func TestExitCode(t *testing.T) {
cmd := helperCommand(t, "exit", "42") cmd := helperCommand(t, "exit", "42")
cmd.Run() cmd.Run()
want := 42 want := 42
if runtime.GOOS == "plan9" {
want = 1
}
got := cmd.ProcessState.ExitCode() got := cmd.ProcessState.ExitCode()
if want != got { if want != got {
t.Errorf("ExitCode got %d, want %d", got, want) t.Errorf("ExitCode got %d, want %d", got, want)
...@@ -181,6 +184,9 @@ func TestExitCode(t *testing.T) { ...@@ -181,6 +184,9 @@ func TestExitCode(t *testing.T) {
cmd = helperCommand(t, "/no-exist-executable") cmd = helperCommand(t, "/no-exist-executable")
cmd.Run() cmd.Run()
want = 2 want = 2
if runtime.GOOS == "plan9" {
want = 1
}
got = cmd.ProcessState.ExitCode() got = cmd.ProcessState.ExitCode()
if want != got { if want != got {
t.Errorf("ExitCode got %d, want %d", got, want) t.Errorf("ExitCode got %d, want %d", got, want)
...@@ -189,6 +195,9 @@ func TestExitCode(t *testing.T) { ...@@ -189,6 +195,9 @@ func TestExitCode(t *testing.T) {
cmd = helperCommand(t, "exit", "255") cmd = helperCommand(t, "exit", "255")
cmd.Run() cmd.Run()
want = 255 want = 255
if runtime.GOOS == "plan9" {
want = 1
}
got = cmd.ProcessState.ExitCode() got = cmd.ProcessState.ExitCode()
if want != got { if want != got {
t.Errorf("ExitCode got %d, want %d", got, want) t.Errorf("ExitCode got %d, want %d", got, want)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment