[Python-ideas] Tulip / PEP 3156 (original) (raw)

[Python-ideas] Tulip / PEP 3156 - subprocess events

Paul Moore p.f.moore at gmail.com
Mon Jan 21 00:40:34 CET 2013


On 20 January 2013 23:29, Eli Bendersky <eliben at gmail.com> wrote:

subprocess.Popen has the passfds argument, documented as follows:

passfds is an optional sequence of file descriptors to keep open between the parent and child. Providing any passfds forces closefds to be True. (Unix only)

I thought that was the case, but it seems like this is only really enabling you to manually manage the extra pipes as I was suggesting in my comment.

My current expectation is that the API would be something like eventloop.connect_process(protocol_factory, popen_obj) and the protocol would have data_received and err_received methods called when the stdout or stderr fds have data, and the transport would have a write method to write to stdin.

If anyone has a suggestion for an API that could be used for arbitrary FDs (which I presume could be either input or output) on top of this, I'd be happy to incorporate it - but personally, I can't think of anything that wouldn't be unusably complex :-(

Paul



More information about the Python-ideas mailing list