Skip to content

Commit 5b9d2c0

Browse files
authored
registering timeout handler synchronously (#3810)
1 parent 5540b97 commit 5b9d2c0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

go/tools/bzltestutil/timeout.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import (
2222
)
2323

2424
func RegisterTimeoutHandler() {
25+
// When the Bazel test timeout is reached, Bazel sends a SIGTERM. We
26+
// panic just like native go test would so that the user gets stack
27+
// traces of all running go routines.
28+
// See https://github.com/golang/go/blob/e816eb50140841c524fd07ecb4eaa078954eb47c/src/testing/testing.go#L2351
29+
c := make(chan os.Signal, 1)
30+
signal.Notify(c, syscall.SIGTERM)
2531
go func() {
26-
// When the Bazel test timeout is reached, Bazel sends a SIGTERM. We
27-
// panic just like native go test would so that the user gets stack
28-
// traces of all running go routines.
29-
// See https://github.com/golang/go/blob/e816eb50140841c524fd07ecb4eaa078954eb47c/src/testing/testing.go#L2351
30-
c := make(chan os.Signal, 1)
31-
signal.Notify(c, syscall.SIGTERM)
3232
<-c
3333
debug.SetTraceback("all")
3434
panic("test timed out")

0 commit comments

Comments
 (0)