]> Cypherpunks repositories - gostls13.git/commitdiff
testing: fix example test fd leak
authorEmil Hessman <c.emil.hessman@gmail.com>
Sat, 22 Dec 2012 18:41:01 +0000 (13:41 -0500)
committerRuss Cox <rsc@golang.org>
Sat, 22 Dec 2012 18:41:01 +0000 (13:41 -0500)
Close the read side of the pipe.
Fixes #4551.

R=rsc
CC=golang-dev
https://golang.org/cl/6962049

src/pkg/testing/example.go

index dc97255965e06da0a229603ae26b35aec2ee1edd..34d4b2bda99bfe5372926a8882495925b07444a0 100644 (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)