The Voidspace Techie Blog

Gravatar You might get some useful hints from supervisor2's "options.py.ServerOptions.make_pipes" method (http://www.plope.com/software/supervisor2/). This code helps the daemon side of a process controller which needs to read both stdout and stderr from multiple subprocesses. It does this by using a select loop, but a thread would likely work just as well.


Gravatar Try popen4(). It returns two file handles. One is stdin for the subprocess and the other is a combination of stdout and stderr for the subprocess.


Gravatar You might also like to pass bufsize=0 to popen4() if you care about displaying the output as soon as it's available from the program you're running. This makes the output buffering line-based or perhaps disables buffering completely (can't remember which). Either way, you should see the output from the program being run sooner.


Gravatar The subprocess module was introduced in Python 2.4, with the intention of replacing popen*. Might be worth a look.


Name:

Email:

URL:

Comment:  ? 

 

Commenting by HaloScan