L
Laszlo Nagy
Suppose we have a program that writes its process id into a pid file.
Usually the program deletes the pid file when it exists... But in some
cases (for example, killed with kill -9 or TerminateProcess) pid file is
left there. I would like to know if a process (given with its process
id) is still running or not. I know that this can be done with OS
specific calls. But that is not portable. It can also be done by
executing "ps -p 23423" with subprocess module, but that is not portable
either. Is there a portable way to do this?
If not, would it be a good idea to implement this (I think very
primitive) function in the os module?
Thanks,
Laszlo
Usually the program deletes the pid file when it exists... But in some
cases (for example, killed with kill -9 or TerminateProcess) pid file is
left there. I would like to know if a process (given with its process
id) is still running or not. I know that this can be done with OS
specific calls. But that is not portable. It can also be done by
executing "ps -p 23423" with subprocess module, but that is not portable
either. Is there a portable way to do this?
If not, would it be a good idea to implement this (I think very
primitive) function in the os module?
Thanks,
Laszlo