aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec/exec_windows_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/exec/exec_windows_test.go')
-rw-r--r--src/os/exec/exec_windows_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/os/exec/exec_windows_test.go b/src/os/exec/exec_windows_test.go
index fbccffec0e..bd4dfb31da 100644
--- a/src/os/exec/exec_windows_test.go
+++ b/src/os/exec/exec_windows_test.go
@@ -10,6 +10,7 @@ package exec_test
import (
"io"
"os"
+ "os/exec"
"strconv"
"syscall"
"testing"
@@ -41,3 +42,16 @@ func TestPipePassing(t *testing.T) {
t.Error(err)
}
}
+
+func TestNoInheritHandles(t *testing.T) {
+ cmd := exec.Command("cmd", "/c exit 88")
+ cmd.SysProcAttr = &syscall.SysProcAttr{NoInheritHandles: true}
+ err := cmd.Run()
+ exitError, ok := err.(*exec.ExitError)
+ if !ok {
+ t.Fatalf("got error %v; want ExitError", err)
+ }
+ if exitError.ExitCode() != 88 {
+ t.Fatalf("got exit code %d; want 88", exitError.ExitCode())
+ }
+}