This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: can't CNTRL-C when running os.system in a thread
Type: Stage:
Components: Interpreter Core Versions: Python 2.2
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: facundobatista, morngnstar
Priority: normal Keywords:

Created on 2003-06-18 23:52 by morngnstar, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fibonacci.py morngnstar, 2003-06-18 23:52 test case
Messages (5)
msg16516 - (view) Author: Greg Jones (morngnstar) Date: 2003-06-18 23:52
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.
msg16517 - (view) Author: Greg Jones (morngnstar) Date: 2003-06-19 02:58
Logged In: YES 
user_id=554883

OS is Linux.
msg16518 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005-01-15 19:23
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
msg16519 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005-01-15 19:23
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.
msg16520 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005-05-30 18:30
Logged In: YES 
user_id=752496

Deprecated. Reopen only if still happens in 2.3 or newer. 

.    Facundo
History
Date User Action Args
2022-04-10 16:09:20adminsetgithub: 38678
2003-06-18 23:52:36morngnstarcreate