From: Ian Lance Taylor Date: Thu, 20 Sep 2018 03:09:02 +0000 (-0700) Subject: os: ignore SIGTTIN during TestTTYClose X-Git-Tag: go1.12beta1~732 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=361cf4a8805051ac3b8829fbcd9d64a0d2f50a71;p=gostls13.git os: ignore SIGTTIN during TestTTYClose Otherwise, if the test is run in the background, it will stop waiting for access to the terminal. Change-Id: Ib5224c6cb9060281e05c3b00cd2964445421e774 Reviewed-on: https://go-review.googlesource.com/c/136415 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/os/timeout_test.go b/src/os/timeout_test.go index 1886accb55..4720738d24 100644 --- a/src/os/timeout_test.go +++ b/src/os/timeout_test.go @@ -16,8 +16,10 @@ import ( "io/ioutil" "math/rand" "os" + "os/signal" "runtime" "sync" + "syscall" "testing" "time" ) @@ -591,6 +593,10 @@ func TestRacyWrite(t *testing.T) { // Closing a TTY while reading from it should not hang. Issue 23943. func TestTTYClose(t *testing.T) { + // Ignore SIGTTIN in case we are running in the background. + signal.Ignore(syscall.SIGTTIN) + defer signal.Reset(syscall.SIGTTIN) + f, err := os.Open("/dev/tty") if err != nil { t.Skipf("skipping because opening /dev/tty failed: %v", err)