From: Ian Lance Taylor Date: Wed, 17 Oct 2018 19:46:20 +0000 (-0700) Subject: os/signal: wait for goroutine in TestTerminalSignal X-Git-Tag: go1.12beta1~737 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=dc75744f9c16e6af08f3e4677f28850b874ecc51;p=gostls13.git os/signal: wait for goroutine in TestTerminalSignal Fixes #28169 Change-Id: I187d9effea56357bbb04d4971d284a52ffae61f8 Reviewed-on: https://go-review.googlesource.com/c/142889 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/os/signal/signal_cgo_test.go b/src/os/signal/signal_cgo_test.go index 16aeea8221..3c23090489 100644 --- a/src/os/signal/signal_cgo_test.go +++ b/src/os/signal/signal_cgo_test.go @@ -22,6 +22,7 @@ import ( "os/signal/internal/pty" "strconv" "strings" + "sync" "syscall" "testing" "time" @@ -113,7 +114,11 @@ func TestTerminalSignal(t *testing.T) { const prompt = "prompt> " // Read data from master in the background. + var wg sync.WaitGroup + wg.Add(1) + defer wg.Wait() go func() { + defer wg.Done() input := bufio.NewReader(master) var line, handled []byte for {