mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cgi: close stdout reader pipe when finished
This causes the child, if still writing, to get an error or SIGPIPE and most likely exit so our subsequent wait can finish. A more guaranteed fix would be putting a time limit on the child's overall execution, but this fixes the problem I was having. Fixes #2059 R=rsc CC=golang-dev https://golang.org/cl/4675081
This commit is contained in:
parent
d53385fd0c
commit
1722ec22cd
4 changed files with 87 additions and 4 deletions
|
|
@ -338,7 +338,8 @@ func (c *Cmd) StdinPipe() (io.WriteCloser, os.Error) {
|
|||
|
||||
// StdoutPipe returns a pipe that will be connected to the command's
|
||||
// standard output when the command starts.
|
||||
func (c *Cmd) StdoutPipe() (io.Reader, os.Error) {
|
||||
// The pipe will be closed automatically after Wait sees the command exit.
|
||||
func (c *Cmd) StdoutPipe() (io.ReadCloser, os.Error) {
|
||||
if c.Stdout != nil {
|
||||
return nil, os.NewError("exec: Stdout already set")
|
||||
}
|
||||
|
|
@ -357,7 +358,8 @@ func (c *Cmd) StdoutPipe() (io.Reader, os.Error) {
|
|||
|
||||
// StderrPipe returns a pipe that will be connected to the command's
|
||||
// standard error when the command starts.
|
||||
func (c *Cmd) StderrPipe() (io.Reader, os.Error) {
|
||||
// The pipe will be closed automatically after Wait sees the command exit.
|
||||
func (c *Cmd) StderrPipe() (io.ReadCloser, os.Error) {
|
||||
if c.Stderr != nil {
|
||||
return nil, os.NewError("exec: Stderr already set")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue