]> Cypherpunks repositories - gostls13.git/commitdiff
os/signal: wait for goroutine in TestTerminalSignal
authorIan Lance Taylor <iant@golang.org>
Wed, 17 Oct 2018 19:46:20 +0000 (12:46 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 17 Oct 2018 19:56:31 +0000 (19:56 +0000)
Fixes #28169

Change-Id: I187d9effea56357bbb04d4971d284a52ffae61f8
Reviewed-on: https://go-review.googlesource.com/c/142889
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/os/signal/signal_cgo_test.go

index 16aeea8221cdcb89d16c1a442aac3da8b31caefc..3c23090489f953dd89260208eccf12a864a1e9cc 100644 (file)
@@ -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 {