On Sat, 05 Mar 2005, Oleg Broytmann (phd@mail2.phd.pp.ru) wrote:
> That breaks on SysV.
I only claimed it worked on BSD and Linux, which (IMO) is better than just
Linux!
However, thanks for the tip. Try this:
def is_running(pid):
"""Return true if program with 'pid' exists."""
# Currently Linux specific.
#return os.path.exists('/proc/%s' % pid)
from os import kill
try:
kill(int(pid),0)
return True
except OSError,e:
if e.errno == 1: # exists, but no access
return True
return False
Michael