[Python-bugs-list] [ python-Bugs-481896 ] popen3 file objects hanging

noreply@sourceforge.net noreply@sourceforge.net
Wed, 14 Nov 2001 15:13:13 -0800


Bugs item #481896, was opened at 2001-11-14 15:13
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=481896&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: popen3 file objects hanging

Initial Comment:
RE:#210676
System: Python 2.0 on solaris 8

The above bug is reported closed but I cannot see why.

>>> sub = popen2.Popen3(cmd,1)
>>> sub.fromchild.readlines()  # blocked on stderr


As reported in the above sited bug report, we too are
suffering from this behaviour on file objects returned
by popen3.  It does appear that the stderr buffer is
filling (the app writes a lot of stuff to stderr) and
blocking stdout, but i cannot seem to flush the
buffer.  I need to acquire both stderr and stdout
data.  I have tried setting the bufsize to 0
(unbuffered) but that doesn't work.  I have made the
buffer big, but nothing there.  Might there be
some magic bufsize?

popen4 (which stuffs both stderr and stdout into one
file object) works perfectly as there is no blocking.  

Reading through the bugs about popen3, the bug report
above is exactly what we are experiencing.  The
"solution" offered is not a solution at all. We are
running 3rd party code, i.e. we can't close stderr
inside the application, nor would we want to. stderr
and stdout file descriptors must remain open for
the duration of the application.

Has there been some viable solution to this which has
not been documented?

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=481896&group_id=5470