-
Notifications
You must be signed in to change notification settings - Fork 18k
os/exec: add example showing use of pipe #4290
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
Labels
Milestone
Comments
Why did we make StderrPipe and StdoutPipe return io.ReadCloser instead of io.Reader? I think we at least need a doc clarification. Our docs say "The pipe will be closed automatically after Wait sees the command exit.", but that I assume is referring to the server's side, so the client reads an EOF. |
> Our docs say "The pipe will be closed automatically after Wait sees the command > exit.", but that I assume is referring to the server's side, so the client reads an > EOF. I had assumed this too, but it actually can't close the server side of the pipe, because the process has a handle to it and there's no guarantee that the process hasn't started another process in the background that holds it open. I think it's correct that StderrPipe and StdoutPipe return io.ReadCloser, but I think it's wrong that Wait closes the client side of the pipe. FWIW I'm submitting this issue because of an actual test failure we've seen. For the time being I've stoppped using StdoutPipe, but I'd like to fix it properly. I'm wondering if it might be a good idea to remove closeAfterWait entirely. If we're not going to close the client side of the pipe, then ISTM that all the other current use cases can be catered for by doing the close inside the started goroutine. |
My fault. I made a CL to fix this (http://golang.org/cl/6789043/) but the consensus was that we couldn't fix the issue because of Go 1 issues. I said I'd update the docs, but I have not done so yet. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
The text was updated successfully, but these errors were encountered: