diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-12-22 01:15:33 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-12-22 01:15:33 +0000 |
commit | 409a5e7eb4cca107037fafa4a7eea92603edb83d (patch) | |
tree | 06f36bbef6fae78278f799194ad0df8ba2dabaa1 /libgo/go/testing/example.go | |
parent | 7e9268b4cf01ab87d9b602f592ed2e2facfadda9 (diff) | |
download | gcc-409a5e7eb4cca107037fafa4a7eea92603edb83d.zip gcc-409a5e7eb4cca107037fafa4a7eea92603edb83d.tar.gz gcc-409a5e7eb4cca107037fafa4a7eea92603edb83d.tar.bz2 |
libgo: Update to revision 15193:6fdc1974457c of master library.
From-SVN: r194692
Diffstat (limited to 'libgo/go/testing/example.go')
-rw-r--r-- | libgo/go/testing/example.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libgo/go/testing/example.go b/libgo/go/testing/example.go index 671c798..dc97255 100644 --- a/libgo/go/testing/example.go +++ b/libgo/go/testing/example.go @@ -24,7 +24,7 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int var eg InternalExample - stdout, stderr := os.Stdout, os.Stderr + stdout := os.Stdout for _, eg = range examples { matched, err := matchString(*match, eg.Name) @@ -39,19 +39,19 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int fmt.Printf("=== RUN: %s\n", eg.Name) } - // capture stdout and stderr + // capture stdout r, w, err := os.Pipe() if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } - os.Stdout, os.Stderr = w, w + os.Stdout = w outC := make(chan string) go func() { buf := new(bytes.Buffer) _, err := io.Copy(buf, r) if err != nil { - fmt.Fprintf(stderr, "testing: copying pipe: %v\n", err) + fmt.Fprintf(os.Stderr, "testing: copying pipe: %v\n", err) os.Exit(1) } outC <- buf.String() @@ -62,9 +62,9 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int eg.F() dt := time.Now().Sub(t0) - // close pipe, restore stdout/stderr, get output + // close pipe, restore stdout, get output w.Close() - os.Stdout, os.Stderr = stdout, stderr + os.Stdout = stdout out := <-outC // report any errors |