Commit 361cf4a8 authored by Ian Lance Taylor's avatar Ian Lance Taylor

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 <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 830f424c
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment