Synchronous capture of stdout and stderr

Konrad Wojas usenet at wojas.vvtp.tudelft.nl
Fri Aug 30 14:36:59 EDT 2002


Hi,

I'm working on a build tool that captures the stdout and stderr of an 
application and mails the output if a compile fails. I'm now using 
popen2.popen3 and the select module, but I don't receive the two streams in 
the same order as the application sends them.

I could try to use popen2.popen4 or the functions in the pty module, but 
then I would not be able to distinguish between the two streams.

Is there a way to achieve this? Is it possible to somehow turn on line 
buffering on the streams and let the controlled process block on each 
written line?

I'm using Linux and the solution doesn't have to be portable.

Regards,

Konrad Wojas




More information about the Python-list mailing list