misc/cgo/stdio: make it work on Windows and also test it
use a function to get stdout and stderr, instead of depending
on a specific libc implementation.
also make test/run.go replace \r\n by \n before comparing
output.
Fixes #2121.
Part of issue 1741.
R=alex.brainman, rsc, r, remyoudompheng
CC=golang-dev
https://golang.org/cl/5847068
diff --git a/test/run.go b/test/run.go
index b238606..c82c138 100644
--- a/test/run.go
+++ b/test/run.go
@@ -344,7 +344,7 @@
if err != nil {
t.err = fmt.Errorf("%s\n%s", err, out)
}
- if string(out) != t.expectedOutput() {
+ if strings.Replace(string(out), "\r\n", "\n", -1) != t.expectedOutput() {
t.err = fmt.Errorf("incorrect output\n%s", out)
}