[ python-Bugs-998246 ] Popen3.poll race condition

SourceForge.net noreply at sourceforge.net
Mon Jul 26 21:14:59 CEST 2004


Bugs item #998246, was opened at 2004-07-26 15:14
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=998246&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tres Seaver (tseaver)
Assigned to: Nobody/Anonymous (nobody)
Summary: Popen3.poll race condition

Initial Comment:
poll() swallows all IOErrors, including ENOCHILD;  if
the child process exits before poll is called, then an
applications which loops on
poll() will never exit.

I am working around this (against Python 2.3.3) via the
following:


                try:
                    pid, status = os.waitpid(proc.pid,
os.WNOHANG)
                except os.error, e:
                    if e.errno == 10:  # ENOCHILD
                        result = 0
                    else:
                        raise
                else:
                    if pid == proc.pid:
                        result = status


where 'proc' is an instance of Popen3.

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

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


More information about the Python-bugs-list mailing list