From dd87e33d88eadaf5302895fb91b0a0e2e16b136e Mon Sep 17 00:00:00 2001 From: cui fliter Date: Fri, 18 Nov 2022 14:06:56 +0800 Subject: os: use testenv.Command instead of exec.Command in tests testenv.Command sets a default timeout based on the test's deadline and sends SIGQUIT (where supported) in case of a hang. Change-Id: I84d469d12ca1f39175b713ca41e7cd2202d11d96 Reviewed-on: https://go-review.googlesource.com/c/go/+/451895 Auto-Submit: Bryan Mills TryBot-Result: Gopher Robot Run-TryBot: Bryan Mills Reviewed-by: Bryan Mills Reviewed-by: Ian Lance Taylor --- src/os/exec/exec_windows_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/os/exec/exec_windows_test.go') diff --git a/src/os/exec/exec_windows_test.go b/src/os/exec/exec_windows_test.go index b39790d61a..efd37107ed 100644 --- a/src/os/exec/exec_windows_test.go +++ b/src/os/exec/exec_windows_test.go @@ -8,6 +8,7 @@ package exec_test import ( "fmt" + "internal/testenv" "io" "os" "os/exec" @@ -69,7 +70,7 @@ func TestPipePassing(t *testing.T) { func TestNoInheritHandles(t *testing.T) { t.Parallel() - cmd := exec.Command("cmd", "/c exit 88") + cmd := testenv.Command(t, "cmd", "/c exit 88") cmd.SysProcAttr = &syscall.SysProcAttr{NoInheritHandles: true} err := cmd.Run() exitError, ok := err.(*exec.ExitError) -- cgit v1.3