Eryk Sun <eryk...@gmail.com> added the comment:

Gregory's last example reminded me that CMD checks for STATUS_CONTROL_C_EXIT 
for more than simply printing "^C". It also breaks out of a FOR loop when 
interactive and prompts to continue when executing a batch script.

Normally CMD also gets a console control event when the user presses Ctrl+C, so 
it knows about the Ctrl+C regardless of the child's exit status. One exception 
is when we start a process with a new console via CMD's `start` command. In 
this case CMD doesn't get a Ctrl+C event, since it's attached to a different 
console. Another exception is a simulated keyboard interrupt (e.g. from C raise 
SIGINT or Python _thread.interrupt_main). In these cases, CMD depends on the 
exit status value to determine whether the process was terminated by the 
default Ctrl+C handler. I've demonstrated this in the files winsig.bat and 
winsig.py. Put both in the same directory and run winsig.bat.

----------
Added file: https://bugs.python.org/file48141/winsig.bat

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue1054041>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to