-
Notifications
You must be signed in to change notification settings - Fork 18k
os/exec: when NoInheritHandles is set with a handle on Stdout or Stderr, executed command fails #45538
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
Comments
Is the problem here that I'm actually not sure what CC @ianlancetaylor @bradfitz via https://dev.golang.org/owners |
I think it would be useful to get more information about what the behavior is that you expect in this scenario. |
Also, is this |
windows/386,i need NoInheritHandles set true and Redirection stdout,stderr to file. |
cc @alexbrainman @mattn @zx2c4 @gopherbot remove WaitingForInfo |
This is intended behavior. Everything is working as expected. There is no bug here. HOWEVER, if what you're looking for is that handles you don't specify aren't accidentally leaked to the child process, that will be the case in Go 1.17. So: you can probably close this bug, and just wait til 1.17 to get the behavior you desire. I agree 1.16's semantics are worrisome, and understand why you would want this, which is why it's been changed. But for 1.16, that's how it is. |
@zx2c4 ok,expecting 1.17. |
Can confirm this is working as expected, the child process can't write its output to |
go version 1.16 windows/386
if use c.Stdout = out,c.Wait() return error exit status 1
The text was updated successfully, but these errors were encountered: