popen2.popen3 deadlock

P_spam_ at draigBrady.com P_spam_ at draigBrady.com
Fri Dec 13 15:07:22 EST 2002


I was just wondering about the popen2.popen3 functionality
(under 1.5.2 currently). If you do:

#import popen2
po, pi, pe = popen2.popen3("./genoutput")
po.read()
pe.read()

Then if genoutput fills its stderr stdio buffer before
it's finished writing to it's stdout then there will
be a deadlock. Fair enough.

But the interface seems useless/dangerous in it's current form.
For e.g. why aren't returned files set non blocking by
default so it would be abvious to users that they have to
process these in a select loop? I wouldn't worry about breaking
old scripts as they're broken by design anyway. Just wondering...

cheers,
Pádraig.




More information about the Python-list mailing list