
On 09/10/2010 03:21 PM, Boris Schaeling wrote:
[snip]
I'm a bit confused: If you use fileno like above on Windows (0=stdin, 1=stdout and 2=stderr) then we could also use an enumeration? At least your implementation of inherit makes me think so that it's not the file descriptor itself you are interested in but only the information whether the standard input, output or error stream is configured. Then there would be no difference between your and mine solution?
It seems that you should just use a different name for the stream behavior depending on which direction of pipe it will create. It would be possible for the user to configure pipes for standard streams in the direction opposite from what is standard (and also perhaps opposite from what the user intended), but such a problem would likely be fairly obvious to figure out. You could also provide a bidirectional pipe (created using socketpair on POSIX, maybe something else on Windows), though it may be better to use pipe on POSIX as people probably expect a unidrectional pipe normally (it seems possible that socketpair uses twice as much kernel buffer space, also). Note: As I mentioned in another message, I think that the parent-end of the pipe should be returned to the user as part of configuring the stream behavior. This would further reduce confusion and chance of incorrectly configuring the direction. The documentation could also address this.