[New-bugs-announce] [issue14229] On KeyboardInterrupt, the exit code should mirror the signal number

Antoine Pitrou report at bugs.python.org
Thu Mar 8 21:21:25 CET 2012


New submission from Antoine Pitrou <pitrou at free.fr>:

Compare:

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

with:

$ ./python -c "import subprocess, signal, time; p = subprocess.Popen(['python', '-c', 'input()']); time.sleep(1); p.send_signal(signal.SIGINT); print(p.wait())"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
KeyboardInterrupt
1

Python's behaviour apparently breaks a common assumption towards Unix processes (see bug reported at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=652926). A solution would be to add a signal number attribute to KeyboardInterrupt, and use that value when computing the process exit code.

----------
components: Interpreter Core
messages: 155174
nosy: loewis, neologix, pitrou
priority: normal
severity: normal
status: open
title: On KeyboardInterrupt, the exit code should mirror the signal number
type: enhancement
versions: Python 3.3

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


More information about the New-bugs-announce mailing list