Direct interaction with subprocess - the curse of blocking I/O

Scott David Daniels Scott.Daniels at Acm.Org
Mon Jun 29 23:43:31 CEST 2009


Pascal Chambon wrote:
> I've had real issues with subprocesses recently : from a python script, 
> on windows, I wanted to "give control" to a command line utility, i.e 
> forward user in put to it and display its output on console....
> Browsing the web, I found some hints :
> - use the advanced win32 api to create non-blocking I/O : rather 
> complicated, non portable ...
> 
> So well, I'd like to know, do you people know any solution to this 
> simple problem - making a user interact directly with a subprocess ? Or 
> would this really require a library handling each case separately (win32 
> api, select().....) ?

I would guess the architectural differences are so great that an attempt
to "do something simple" is going to involve architecture-specific code.
and I personally wouldn't have it any other way.  Simulating a shell
with hooks on its I/O should be so complicated that a "script kiddie"
has trouble writing a Trojan.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list