os.kill........

Chris Liechti cliechti at gmx.net
Tue Nov 20 13:34:53 EST 2001


[posted and mailed]

Martin Franklin <martin.franklin at westgeo.com> wrote in
news:9te2g4$sma$1 at mail1.wg.waii.com: 
> Hi,
> 
> 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 do
> nothing if the process does exist.  The sig of zero does not _seem_ to
> affect it (at least not on my linux box)
> 
> My question is.....  is this an OK way of doing this?  do I have any
> other _pure_ python options.....
> 
> 
> Regards
> Martin

from "man 7 signal"
SIGHUP        1        A      Hangup detected on controlling terminal
                              or death of controlling process
SIGINT        2        A      Interrupt from keyboard
SIGQUIT       3        C      Quit from keyboard
SIGILL        4        C      Illegal Instruction
SIGABRT       6        C      Abort signal from abort(3)
SIGFPE        8        C      Floating point exception
SIGKILL       9       AEF     Kill signal
SIGSEGV      11        C      Invalid memory reference
SIGPIPE      13        A      Broken pipe: write to pipe with no readers
SIGALRM      14        A      Timer signal from alarm(2)
SIGTERM      15        A      Termination signal

a frendly question to quit is sent by signal 9 and an unfrendly, forced 
kill of a process can be done with signal 15.

as i understand signal 0 only _checks_ if a process is exiting.

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list