From 0df08b955371b7953350a834fd27c594fc45fe73 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Tue, 15 Nov 2022 10:53:41 -0500 Subject: [PATCH] cmd/vet: 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: I973be280cd0a7f495b491bfb0e04771389562e04 Reviewed-on: https://go-review.googlesource.com/c/go/+/450711 Reviewed-by: Ian Lance Taylor Run-TryBot: Bryan Mills TryBot-Result: Gopher Robot Auto-Submit: Bryan Mills --- src/cmd/vet/vet_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/vet/vet_test.go b/src/cmd/vet/vet_test.go index fed88e7978..280ed8d7ae 100644 --- a/src/cmd/vet/vet_test.go +++ b/src/cmd/vet/vet_test.go @@ -54,7 +54,7 @@ var ( ) func vetCmd(t *testing.T, arg, pkg string) *exec.Cmd { - cmd := exec.Command(testenv.GoToolPath(t), "vet", "-vettool="+vetPath(t), arg, path.Join("cmd/vet/testdata", pkg)) + cmd := testenv.Command(t, testenv.GoToolPath(t), "vet", "-vettool="+vetPath(t), arg, path.Join("cmd/vet/testdata", pkg)) cmd.Env = os.Environ() return cmd } @@ -125,7 +125,7 @@ func cgoEnabled(t *testing.T) bool { // That's fine for the builders, but causes commands like // 'GOARCH=386 go test .' to fail. // Instead, we ask the go command. - cmd := exec.Command(testenv.GoToolPath(t), "list", "-f", "{{context.CgoEnabled}}") + cmd := testenv.Command(t, testenv.GoToolPath(t), "list", "-f", "{{context.CgoEnabled}}") out, _ := cmd.CombinedOutput() return string(out) == "true\n" } -- 2.50.0