[issue14229] On KeyboardInterrupt, the exit code should mirror the signal number

Charles-François Natali report at bugs.python.org
Tue Mar 20 19:56:38 CET 2012


Charles-François Natali <neologix at free.fr> added the comment:

I agree with Martin: we really do handle the signal, and as such, the
only way to convey the relevant information to the parent as to which
signal caused the exit would be to re-raise it, which is really ugly
and probably not a good idea.

Processes that want default behavior upon signal reception (so that
they can use WEXITSTATUS(), WCOREDUMP() and friends) can always use
SIG_DFL:

$ python -c "import subprocess, signal, time; p =
subprocess.Popen(['python', '-c', 'import signal;
signal.signal(signal.SIGINT, signal.SIG_DFL); input()']);
time.sleep(1); p.send_signal(signal.SIGINT); print(p.wait())"
-2

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14229>
_______________________________________


More information about the Python-bugs-list mailing list