29 Mar 2012 04:55
[PATCH] Ctrl-C and non-Cygwin programs
Ein Terakawa <applause <at> elfmimi.jp>
2012-03-29 02:55:51 GMT
2012-03-29 02:55:51 GMT
This is a proof of concept demonstration which makes Ctrl-C behave in a way a lot of people expect concerning non-Cygwin console programs. What it does actually is it generates CTRL_BREAK_EVENT with Windows Console API GenerateConsoleCtrlEvent on the arrival of SIGINT. And to make this scheme to be functional it is required to specify CREATE_NEW_PROCESS_GROUP when creating new non-Cygwin processes. To my surprise there seem to be no way to generate CTRL_C_EVENT using API. I must also point out that virtually all of the terminal emulators are sneakily keeping hidden Windows Console in the background. Thus several features of the Windows Console is still available to processes running in the cygwin environment. One of such features is this 'process group' and the other one is 'code page' which you manipulate with chcp.com utility. Following is a bunch of random posts, I picked up from this list, talking about the same topic. Ordered by its significance under my judge. These should help you understand (or remind) what it is about. Date: Mon, 04 Dec 2006 06:24:41 -0800 Subject: Re: Ctrl-C and non-cygwin programs http://cygwin.com/ml/cygwin/2006-12/msg00151.html Date: Thu, 20 May 2010 22:50:49 +0000 (UTC) Subject: A workaround for CTRL-C not working on Windows console apps in ptys http://sourceware.org/ml/cygwin/2010-05/msg00524.html(Continue reading)
RSS Feed