1
0
mirror of https://github.com/golang/go synced 2024-09-29 18:24:29 -06:00

cmd/pack: 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: Ia1dd1bacfa2c9378401bbce304ebf7ee3f159352
Reviewed-on: https://go-review.googlesource.com/c/go/+/450707
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Bryan C. Mills 2022-11-15 10:45:00 -05:00 committed by Gopher Robot
parent af7437cc8a
commit 3e1519d05a

View File

@ -12,7 +12,6 @@ import (
"io" "io"
"io/fs" "io/fs"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"strings" "strings"
"sync" "sync"
@ -410,7 +409,7 @@ func TestRWithNonexistentFile(t *testing.T) {
// doRun runs a program in a directory and returns the output. // doRun runs a program in a directory and returns the output.
func doRun(t *testing.T, dir string, args ...string) string { func doRun(t *testing.T, dir string, args ...string) string {
cmd := exec.Command(args[0], args[1:]...) cmd := testenv.Command(t, args[0], args[1:]...)
cmd.Dir = dir cmd.Dir = dir
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
if err != nil { if err != nil {