Re: Best way to determine if a certain PID is still running

2006-02-03 Thread MrJean1
Take look at the poll() methods in the subprocess.py source file of your Python install. It shows how to use the os.wait_pid(pid, os.WNOHANG) to check whether a process is still running or has terminated (and how, from the returned status value). Btw, on *nix you must call os.wait_pid(pid, ...) t

Re: Best way to determine if a certain PID is still running

2006-02-03 Thread MrJean1
Take look at the poll() methods in the subprocess.py source file of your Python install. It shows how to use the os.wait_pid(pid, os.WNOHANG) to check whether a process is still running or has terminated (and how, from the returned status value). Btw, on *nix you must call os.wait_pid(pid, ...) t

Re: Best way to determine if a certain PID is still running

2006-02-03 Thread Thomas Guettler
Am Thu, 02 Feb 2006 17:10:24 -0800 schrieb David Hirschfield: > I'm launching a process via an os.spawnvp(os.P_NOWAIT,...) call. > So now I have the pid of the process, and I want a way to see if that > process is complete. > > I don't want to block on os.waitpid(), I just want a quick way to se

Re: Best way to determine if a certain PID is still running

2006-02-03 Thread Roy Smith
David Hirschfield <[EMAIL PROTECTED]> wrote: > I'm launching a process via an os.spawnvp(os.P_NOWAIT,...) call. > So now I have the pid of the process, and I want a way to see if that > process is complete. > > I don't want to block on os.waitpid(), I just want a quick way to see if > the proce

Re: Best way to determine if a certain PID is still running

2006-02-03 Thread Lars Gustäbel
On Thu, Feb 02, 2006 at 05:10:24PM -0800, David Hirschfield wrote: > I'm launching a process via an os.spawnvp(os.P_NOWAIT,...) call. > So now I have the pid of the process, and I want a way to see if that > process is complete. > > I don't want to block on os.waitpid(), I just want a quick way t

Re: Best way to determine if a certain PID is still running

2006-02-03 Thread Paul Rubin
David Hirschfield <[EMAIL PROTECTED]> 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 doi

Best way to determine if a certain PID is still running

2006-02-03 Thread David Hirschfield
I'm launching a process via an os.spawnvp(os.P_NOWAIT,...) call. So now I have the pid of the process, and I want a way to see if that process is complete. I don't want to block on os.waitpid(), I just want a quick way to see if the process I started is finished. I could popen("ps -p %d" % pid)