[cancelable stdin] fix c.notify

This commit is contained in:
chzyer 2016-10-06 12:33:21 +08:00
parent 17b536725b
commit 5197e2b2ba
1 changed files with 5 additions and 1 deletions

6
std.go
View File

@ -112,7 +112,11 @@ func (c *CancelableStdin) Read(b []byte) (n int, err error) {
}
c.data = b
c.notify <- struct{}{}
select {
case c.notify <- struct{}{}:
case <-c.stop:
return 0, io.EOF
}
select {
case <-c.notify:
return c.read, c.err