diff --git a/internal/processtest/processtest_test.go b/internal/processtest/processtest_test.go index 0d46cdd00..60dff45bd 100644 --- a/internal/processtest/processtest_test.go +++ b/internal/processtest/processtest_test.go @@ -18,10 +18,12 @@ package processtest_test import ( "bytes" + "context" "os" "path/filepath" "strings" "testing" + "time" exec "golang.org/x/sys/execabs" ) @@ -43,7 +45,10 @@ func TestPrograms(t *testing.T) { } t.Run(n, func(t *testing.T) { - cmd := exec.Command("go", "run", filepath.Join(dir, n)) + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + + cmd := exec.CommandContext(ctx, "go", "run", filepath.Join(dir, n)) stderr := &bytes.Buffer{} cmd.Stderr = stderr if err := cmd.Run(); err != nil {