diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-08-03 17:26:15 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-08-03 17:31:49 +0200 |
| commit | b757d264230d65f988e08158e096a09497d39eb4 (patch) | |
| tree | e20ec608a2ec8ebf603fa7aa060eb9723c4780b9 /src/pkg/exec/exec.go | |
| parent | 5976088995f5c0d0bcada7d491fda4b6245e54e0 (diff) | |
| download | golang-b757d264230d65f988e08158e096a09497d39eb4.tar.gz | |
Imported Upstream version 2011.07.29
Diffstat (limited to 'src/pkg/exec/exec.go')
| -rw-r--r-- | src/pkg/exec/exec.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/pkg/exec/exec.go b/src/pkg/exec/exec.go index 5b988d5eb..3b20f2008 100644 --- a/src/pkg/exec/exec.go +++ b/src/pkg/exec/exec.go @@ -332,13 +332,14 @@ func (c *Cmd) StdinPipe() (io.WriteCloser, os.Error) { } c.Stdin = pr c.closeAfterStart = append(c.closeAfterStart, pr) - c.closeAfterWait = append(c.closeAfterStart, pw) + c.closeAfterWait = append(c.closeAfterWait, pw) return pw, nil } // 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") } @@ -351,13 +352,14 @@ func (c *Cmd) StdoutPipe() (io.Reader, os.Error) { } c.Stdout = pw c.closeAfterStart = append(c.closeAfterStart, pw) - c.closeAfterWait = append(c.closeAfterStart, pr) + c.closeAfterWait = append(c.closeAfterWait, pr) return pr, nil } // 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") } @@ -370,6 +372,6 @@ func (c *Cmd) StderrPipe() (io.Reader, os.Error) { } c.Stderr = pw c.closeAfterStart = append(c.closeAfterStart, pw) - c.closeAfterWait = append(c.closeAfterStart, pr) + c.closeAfterWait = append(c.closeAfterWait, pr) return pr, nil } |
