In article 
<[EMAIL PROTECTED]>,
 bukzor <[EMAIL PROTECTED]> wrote:

> Does anyone have a pythonic way to check if a process is dead, given
> the pid?
> 
> This is the function I'm using is quite OS dependent. A good candidate
> might be "try: kill(pid)", since it throws an exception if the pid is
> dead, but that sends a signal which might interfere with the process.
> 
> Thanks.
> --Buck

The canonical way is to do kill(pid, 0).  If it doesn't throw, the process 
exists.  No actual signal is sent to the process either way.

Of course, the process could exit immediately after the kill() call, so by 
the time you find out it's alive, it's dead.  Such is life.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to