Skip to content

Commit cc795a0

Browse files
committed
testenv: kill subprocess if SIGQUIT doesn't do it
This makes testenv.RunWithTimeout first attempt to SIGQUIT the subprocess to get a useful Go traceback, but if that doesn't work, it sends a SIGKILL instead to make sure we tear down the subprocess. This is potentially important for non-Go subprocesses. For #37405. Change-Id: I9e7e118dc5769ec3f45288a71658733bff30c9cd Reviewed-on: https://go-review.googlesource.com/c/go/+/370702 Trust: Austin Clements <[email protected]> Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 6b89773 commit cc795a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/internal/testenv/testenv.go

+7
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,13 @@ func RunWithTimeout(t testing.TB, cmd *exec.Cmd) ([]byte, error) {
346346
case <-done:
347347
case <-time.After(time.Duration(scale) * time.Minute):
348348
p.Signal(Sigquit)
349+
// If SIGQUIT doesn't do it after a little
350+
// while, kill the process.
351+
select {
352+
case <-done:
353+
case <-time.After(time.Duration(scale) * 30 * time.Second):
354+
p.Signal(os.Kill)
355+
}
349356
}
350357
}()
351358

0 commit comments

Comments
 (0)