-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Description
What version of Go are you using (go version)?
$ go version go version go1.16.2 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/wingerse/.cache/go-build" GOENV="/home/wingerse/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/wingerse/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/wingerse/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib/go-1.16" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib/go-1.16/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.16.2" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1365221385=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Run CombinedOutput on a command that will error.
https://play.golang.org/p/TLNqCABOTCu
What did you expect to see?
I expect to see the content of stderr.
The documentation implies it should be copied to the buffer:
Otherwise, during the execution of the command a separate goroutine
reads from the process over a pipe and delivers that data to the
corresponding Writer. In this case, Wait does not complete until the
goroutine reaches EOF or encounters an error.
The process exists after writing to its stderr, so I should be able to read it to my buffer.
What did you see instead?
I see nothing.
If I set cmd.Stderr = os.Stderr, it is copied properly though: https://play.golang.org/p/bWlSY8F2sLo