os.kill........

Erik Max Francis max at alcyone.com
Tue Nov 20 13:28:16 EST 2001


Martin Franklin wrote:

> I'm looking for a way of determining if a process is still running
> (having
> spawned it from a python app), I have come up with os.kill(PID, 0)
> this will raise an exception if the process does not exist, and doe
> nothing
> if the process does exist.  The sig of zero does not _seem_ to affect
> it
> (at least not on my linux box)

This is fairly standard idiom under UNIX.  Often more harmless calls are
made, such as getpriority (of which I don't know if there's a Python
equivalent).

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Laws are silent in time of war.
\__/ Cicero
    Esperanto reference / http://www.alcyone.com/max/lang/esperanto/
 An Esperanto reference for English speakers.



More information about the Python-list mailing list