[Python-bugs-list] [ python-Bugs-756940 ] can't CNTRL-C when running os.system in a thread
SourceForge.net
noreply@sourceforge.net
Wed, 18 Jun 2003 19:58:55 -0700
Bugs item #756940, was opened at 2003-06-18 16:52
Message generated for change (Comment added) made by morngnstar
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=756940&group_id=5470
Category: Threads
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Jones (morngnstar)
Assigned to: Nobody/Anonymous (nobody)
Summary: can't CNTRL-C when running os.system in a thread
Initial Comment:
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.
----------------------------------------------------------------------
>Comment By: Greg Jones (morngnstar)
Date: 2003-06-18 19:58
Message:
Logged In: YES
user_id=554883
OS is Linux.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=756940&group_id=5470