Message60590
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. |
|
Date |
User |
Action |
Args |
2008-01-20 09:57:15 | admin | link | issue1054041 messages |
2008-01-20 09:57:15 | admin | create | |
|