You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm unsure what is happening, but seems like using -v changes the behavior of exec in
tests. Notably run the attached test with and without the -v to see one run pass, and
the other hang and eventually fail.
Thanks.
What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. http://play.golang.org/p/6R0zNv4uAN (also attached)
2. Run test with -v, and see it pass: go test -v gotestv_test.go
3. Run test without -v, and see it hang: go test gotestv_test.go
What is the expected output?
The behavior should be the same between the two. IMO the external process shouldn't
block the test run from finishing, so the behavior when using -v of the test succeeding
is the correct one.
What do you see instead?
The test hangs when not using -v.
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
Mac OS X. Also reproduced on Linux.
Which version are you using? (run 'go version')
go version go1.2 darwin/amd64
This is happening because the one mode is waiting for an EOF on the stdout/stderr pipe,
which it won't get until the sleep subprocess exits, and the other mode is not waiting
for the EOF. In -v mode stdout/stderr is connected to the 'go test's actual
stdout/stderr, so that output shows up as soon as it is generated. This is a feature.
Unfortunately it means that you cannot tell something else has the fd open when the test
exits. I don't see any way around this, and the bug is much less significant than the
feature, so it's working as intended.
Attachments:
The text was updated successfully, but these errors were encountered: