Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/exec: Wait waits for EOF on stdout pipe #7378

Closed
gopherbot opened this issue Feb 21, 2014 · 1 comment
Closed

os/exec: Wait waits for EOF on stdout pipe #7378

gopherbot opened this issue Feb 21, 2014 · 1 comment

Comments

@gopherbot
Copy link
Contributor

by ikari.shinji.eva:

What steps will reproduce the problem?
run http://play.golang.org/p/VwzEpAHA7M (Cannot run in playground, please run it on a
mac/linux)

What is the expected output?
all 3 steps should be returned immediately

What do you see instead?
the 2nd step, when redirect Stdout to a bytes.buffer, spend 3 seconds, which means it
returned after  the background process ("sleep 3 &") return

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Mac OS X 10.9.1 (13B42)

Which version are you using?  (run 'go version')
go version go1.2 darwin/amd64

Please provide any additional information below.
in exec.Cmd.Wait, it will wait all c.goroutine's errch chan, no matter if the process is
finished or running in background. It's where the call blocks.
@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 1:

It's not clear that we can do much better. If we stop reading from the pipe before EOF,
there is a race and we might not have gotten all the results. I really think this is the
best we can do. It's fundamental to how Unix works. What if the sleep was going to print
some more output?

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants