os.wait() losing child?

Jason Zheng Xin.Zheng at jpl.nasa.gov
Wed Jul 11 20:41:53 EDT 2007


Nick Craig-Wood wrote:
> The problem you are having is you are letting Popen do half the job
> and doing the other half yourself.

Except that I never wanted Popen to do any thread management for me to 
begin with. Popen class has advertised itself as a replacement for 
os.popen, popen2, popen4, and etc., and IMHO it should leave the 
clean-up to the users, or at least leave it as an option.

> Here is a way which works, done completely with Popen.  Polling the
> subprocesses is slightly less efficient than using os.wait() but does
> work.  In practice you want to do this anyway to see if your children
> exceed their time limits etc.

I think your polling way works; it seems there no other way around this 
problem other than polling or extending Popen class.

thanks,

Jason



More information about the Python-list mailing list