Paul Moore wrote:
2009/7/27 Eric Pruitt <eric.pruitt@gmail.com>:
Hello,
Since there was a bit of confusion last time, I'll start by saying I am working on the subprocess.Popen module for Google Summer of Code. One of the features I am implementing is a class so that a running process can stand in in place of a file. For examples, instead of open( "filelist", mode = 'r') one would call ProcessIOWrapper( "ls -l", mode = 'r'). I am trying to decide if I should fully implement the mode argument. Right now, it essentially ignores everything but a 'U' indicated universal newlines in the mode argument. Should I leave that as is or make it so that things like "r+", "w", "a" are handled the way they would be for an actual file?
I would expect "r" to produce a pipe that reads from stdout of the subprocess, and "w" to produce a pipe that writes to stdin of the subprocess. "a" would be the same as "w", and arguably "r+" would be a bidirectional pipe - read from the subprocess stdout and write to its stdin.
I'd be OK with "r+" not being implemented (if it's too hard to avoid deadlocks) but "r" and "w" should be present.
What about stderr? You could add "e" if you want to read from it.