|
|
|
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.
Chris McDonough |
07/01/07 - 8:49 pm | #
|
|
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.
Doug |
Homepage |
07/01/07 - 9:26 pm | #
|
|
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.
Menno Smits |
Homepage |
07/01/08 - 11:20 am | #
|
|
The subprocess module was introduced in Python 2.4, with the intention of replacing popen*. Might be worth a look.
Jim Eggleston |
07/01/08 - 9:51 pm | #
|
|
|
Commenting by HaloScan
|