mirror of
https://github.com/golang/go
synced 2024-11-26 20:21:25 -07:00
674bbafce6
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
23 lines
614 B
Go
23 lines
614 B
Go
// skip
|
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package stdio
|
|
|
|
/*
|
|
#include <stdio.h>
|
|
|
|
// on mingw, stderr and stdout are defined as &_iob[FILENO]
|
|
// on netbsd, they are defined as &__sF[FILENO]
|
|
// and cgo doesn't recognize them, so write a function to get them,
|
|
// instead of depending on internals of libc implementation.
|
|
FILE *getStdout(void) { return stdout; }
|
|
FILE *getStderr(void) { return stderr; }
|
|
*/
|
|
import "C"
|
|
|
|
var Stdout = (*File)(C.getStdout())
|
|
var Stderr = (*File)(C.getStderr())
|