This reverts CL 437176.
Reason for revert: broke programs that plumb StdoutPipe from one command to Stdin on another and then call Wait on the former.
os/exec itself uses a type-assertion to *os.File to determine whether to copy stdin using a goroutine or just pass a file descriptor. An early Wait using a *os.File is benign (because closing the pipe doesn't close the child's inherited file descriptor), but an early Wait using a non-*os.File is not.
Updates #50436.
Change-Id: I4a2993e290982834f91696d890dfe77364c0cc50
Reviewed-on: https://go-review.googlesource.com/c/go/+/438695
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
}
c.Stdout = pw
c.childIOFiles = append(c.childIOFiles, pw)
- rc := &closeOnce{File: pr}
- c.parentIOPipes = append(c.parentIOPipes, rc)
- return rc, nil
+ c.parentIOPipes = append(c.parentIOPipes, pr)
+ return pr, nil
}
// StderrPipe returns a pipe that will be connected to the command's
}
c.Stderr = pw
c.childIOFiles = append(c.childIOFiles, pw)
- rc := &closeOnce{File: pr}
- c.parentIOPipes = append(c.parentIOPipes, rc)
- return rc, nil
+ c.parentIOPipes = append(c.parentIOPipes, pr)
+ return pr, nil
}
// prefixSuffixSaver is an io.Writer which retains the first N bytes