Matthew Woodcraft wrote: > greg <[EMAIL PROTECTED]> 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- >
Thanks, that's exactly what I need, my program really needs the os.wait() to be reliable. Perhaps I could pass a flag to Popen to tell it to never os.wait() on the new pid (but it's ok to os.wait() on other Popen instances upon _cleanup()). -- http://mail.python.org/mailman/listinfo/python-list