mirror of
https://github.com/golang/go
synced 2024-11-25 09:47:57 -07:00
testing: fix example test fd leak
Close the read side of the pipe. Fixes #4551. R=rsc CC=golang-dev https://golang.org/cl/6962049
This commit is contained in:
parent
475f3df43f
commit
4b7c2dfcea
@ -50,6 +50,7 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int
|
|||||||
go func() {
|
go func() {
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
_, err := io.Copy(buf, r)
|
_, err := io.Copy(buf, r)
|
||||||
|
r.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "testing: copying pipe: %v\n", err)
|
fmt.Fprintf(os.Stderr, "testing: copying pipe: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user