From b757d264230d65f988e08158e096a09497d39eb4 Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Wed, 3 Aug 2011 17:26:15 +0200 Subject: Imported Upstream version 2011.07.29 --- src/pkg/exec/exec.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/pkg/exec/exec.go') 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 } -- cgit v1.2.3