Ctrl+C not working with windows programs in Cygwin 1.7.16

Daniel Colascione dancol@dancol.org
Thu Aug 2 21:02:00 GMT 2012

On 8/2/2012 12:32 PM, Marcin Kielar wrote:
> Steps to reproduce:
> 1. Start cygwin using cygwin.bat
> 2. Run `ping -t google.com`
> 3. Try breaking it with Ctrl+C

This problem arises from Cygwin's use of CREATE_NEW_PROCESS_GROUP. From MSDN:

"When a process is created with CREATE_NEW_PROCESS_GROUP specified, an implicit
call to SetConsoleCtrlHandler(NULL,TRUE) is made on behalf of the new process;
this means that the new process has CTRL+C disabled. This lets shells handle
CTRL+C themselves, and selectively pass that signal on to sub-processes.
CTRL+BREAK is not disabled, and may be used to interrupt the process/process group."

SetConsoleCtrlHandler(NULL,TRUE) tells a process and all its children to ignore
control-C. This problem only affects programs run in a console --- in a pty,
Cygwin just terminates Windows processes in response to SIGINT.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20120802/0f77045d/attachment.sig>

More information about the Cygwin mailing list