[ python-Bugs-756940 ] can't CNTRL-C when running os.system in a
thread
SourceForge.net
noreply at sourceforge.net
Sat Jan 15 20:23:33 CET 2005
Bugs item #756940, was opened at 2003-06-18 20:52
Message generated for change (Comment added) made by facundobatista
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: Facundo Batista (facundobatista)
Date: 2005-01-15 16:23
Message:
Logged In: YES
user_id=752496
The other bug have a very long discussion about this, and
talks about patches to be applied to Py2.4, and the last
patch is actually accepted. Maybe this is already fixed,
please give it a try.
----------------------------------------------------------------------
Comment By: Facundo Batista (facundobatista)
Date: 2005-01-15 16:23
Message:
Logged In: YES
user_id=752496
Please, could you verify if this problem persists in Python 2.3.4
or 2.4?
If yes, in which version? Can you provide a test case?
If the problem is solved, from which version?
Note that if you fail to answer in one month, I'll close this bug
as "Won't fix".
Thank you!
. Facundo
----------------------------------------------------------------------
Comment By: Greg Jones (morngnstar)
Date: 2003-06-18 23: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
More information about the Python-bugs-list
mailing list