This is related to Bug #756924.
When os.system is called in a thread, Control-C is
ignored.
Steps to reproduce:
1. Download the attached file fibonacci.py.
2. Run python2.2 fibonacci.py.
3. Hit CNTRL-C.
fibonacci.py starts a thread that executes fibonacci.py
again (but with a flag to prevent this from recursing
infinitely). Then it computes and prints the Fibonacci
sequence, the slow way. The process executed in the
thread redirects this to a file to avoid conflict over
stdout. All this is just to give the program something to
do while you hit CNTRL-C.
Expected, and Python 2.1 behavior:
You get a KeyboardInterrupt exception, a stack trace,
and the program exits.
Actual Python 2.2 behavior:
No response. You have to run kill on the process.
Maybe this is not a bug, but rather a limitation of Linux,
since I understand SIGINT is blocked during the C
function 'system'. However, CNTRL-C worked in Python
2.1, and that was nicer.
Removing the lines of code described in Bug #756924
also fix this bug.
|