Best way to determine if a certain PID is still running

Paul Rubin http
Fri Feb 3 04:48:59 EST 2006


David Hirschfield <davidh at ilm.com> writes:
> So, should I run a monitor thread which just calls os.waitpid() and
> when the thread indicates via an event that the process completed, I'm
> golden?

Umm, what OS?  And do you have any control over the program running in
the subprocess, or is it doing something arbitrary?  I.e. I'm
wondering if can you do stuff like sharing a file descriptor with the
subprocess, or keeping a pipe open.  

Using a monitor thread doesn't sound too bad, but there may be ways to
avoid it.  But if you're willing to launch a thread, why not just
spawn there without NOWAIT?



More information about the Python-list mailing list