[ python-Bugs-1054041 ] Python doesn't exit with proper resultcode
on SIGINT
SourceForge.net
noreply at sourceforge.net
Thu Apr 7 11:26:24 CEST 2005
Bugs item #1054041, was opened at 2004-10-25 21:27
Message generated for change (Comment added) made by mwh
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1054041&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: James Y Knight (foom)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python doesn't exit with proper resultcode on SIGINT
Initial Comment:
If you kill a python process with SIGINT (e.g. control-c), it catches
the signal, and raises a KeyboardInterrupt. If the KeyboardInterrupt
propagates to the top level, python exits. However, it exits with a
result of 1, not a result of SIGINT. This means that if you run
python in a shell script, the script will not properly exit on C-c.
When exiting because of a KeyboardInterrupt, python ought to
reraise the SIGINT, as follows, so that the exit code is correct for
the caller:
signal(SIGINT, SIG_DFL);
kill(getpid(), SIGINT);
See also http://www.cons.org/cracauer/sigint.html for a more
detailed discussion on the topic.
----------------------------------------------------------------------
>Comment By: Michael Hudson (mwh)
Date: 2005-04-07 10:26
Message:
Logged In: YES
user_id=6656
Feel like writing a patch?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1054041&group_id=5470
More information about the Python-bugs-list
mailing list