From: Bryan C. Mills Date: Tue, 15 Nov 2022 15:53:41 +0000 (-0500) Subject: cmd/vet: use testenv.Command instead of exec.Command in tests X-Git-Tag: go1.20rc1~238 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0df08b955371b7953350a834fd27c594fc45fe73;p=gostls13.git 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 --- 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" }