1
0
mirror of https://github.com/golang/go synced 2024-11-25 08:07: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:
Emil Hessman 2012-12-22 13:41:01 -05:00 committed by Russ Cox
parent 475f3df43f
commit 4b7c2dfcea

View File

@ -50,6 +50,7 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int
go func() {
buf := new(bytes.Buffer)
_, err := io.Copy(buf, r)
r.Close()
if err != nil {
fmt.Fprintf(os.Stderr, "testing: copying pipe: %v\n", err)
os.Exit(1)