[Python-ideas] Tulip / PEP 3156 - subprocess events
Geert Jansen
geertj at gmail.com
Wed Jan 16 19:20:23 CET 2013
On Wed, Jan 16, 2013 at 8:10 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> I'll have a look. There *is* one problem, though - I imagine it will
> be relatively easy to put something together that works on Unix, as
> waiting on pipes is covered by the existing select/poll mechanisms.
> But I'm on Windows, so I won't be able to test it. And on Windows,
> there's no mechanism in place to wait on arbitrary filehandles, so the
> process wait mechanism is a much harder nut to crack. Chicken and egg
> problem...
>
> Maybe I'll start by looking at waiting on arbitrary filehandles, and
> use that to build the process approach. Unfortunately, I don't think
> IOCP is any more able to wait on arbitrary files than select - see my
> followup to an older thread on Richard's work there. Or maybe I'll set
> up a hacking environment in a Linux VM or something. That'd be a fun
> experience in any case.
Dealing with subprocesses on Windows in a non-blocking way is a royal
pain. As far as I know, the only option is to use named pipes and
block on them using a thread pool. A few years back I wrote something
that did this, see the link below. However it ain't pretty..
https://bitbucket.org/geertj/winpexpect/src/tip/lib/winpexpect.py
Regards,
Geert
More information about the Python-ideas
mailing list