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 <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2018-10-17 12:46:20 -07:00
parent 1d18f66dc8
commit dc75744f9c
1 changed files with 5 additions and 0 deletions

View 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 {