os.wait() losing child?

Matthew Woodcraft mattheww at chiark.greenend.org.uk
Wed Jul 11 14:25:51 EDT 2007


greg  <greg at cosc.canterbury.ac.nz> wrote:
> I've figured out what's going on. The Popen class has a
> __del__ method which does a non-blocking wait of its own.
> So you need to keep the Popen instance for each subprocess
> alive until your wait call has cleaned it up.

I don't think this will be enough for the poster, who has Python 2.4:
in that version, opening a new Popen object would trigger the wait on
all 'outstanding' Popen-managed subprocesses.

It seems to me that subprocess.py assumes that it will do all wait()ing
on its children itself; I'm not sure if it's safe to rely on the
details of how this is currently arranged.

Perhaps a better way would be for subprocess.py to provide its own
variant of os.wait() for people who want 'wait-for-any-child' (though
it would be hard to support programs which also had children not
managed by subprocess.py).

-M-




More information about the Python-list mailing list