Delivered signal info in exit status of a process?
Michael Hoffman
m.h.3.9.1.without.dots.at.cam.ac.uk at example.com
Fri Sep 24 15:26:10 EDT 2004
Ishwar Rattan wrote:
> Here is a piece code (according to blurb on os.wait, the lower
> order 7 bits of exit status of process should contain the signal
> number of signal that terminated the process..) and signal number
> should be 8 (SIGFPE), similar logic in C-code produces expected
> result.
But that's not what happens when you throw a ZeroDivisonError in python:
$ python -c "2/0"
Traceback (most recent call last):
File "<string>", line 1, in ?
ZeroDivisionError: integer division or modulo by zero
$ echo $? # this is the exit status in bash
1
If there is a SIGFPE, Python is trapping it and turning it into an
exception. And it exits with status 1 due to an uncaught exception.
--
Michael Hoffman
More information about the Python-list
mailing list