NTEmacs shell with CygWin: control-C problem

Andrew Innes andrewi@gnu.org
Fri Jan 19 06:20:00 GMT 2001

On Thu, 11 Jan 2001 17:19:17 -0500, Daniel Barclay <Daniel.Barclay@digitalfocus.com> said:
>I'm having trouble with killing commands with control-C in a shell
>In a shell buffer in NTEmacs configured per the shell-setup instructions 
>in the CygWin FAQ at http://sources.redhat.com/cygwin/faq/faq.html#SEC5 , 
>control-C doesn't seem to work.
>That is, typing two control-C's in Emacs (to send a control-C to bash) 
>doesn't kill a long-running command (e.g., like "du /" or "sleep 10").  
>Emacs does seem to flash the window title bar, but I can't tell what it's 
>trying to indicate.

It isn't trying to indicate anything - the flashing is an artefact of
the way NTEmacs tries to interrupt subprocesses.  It temporarily gives
input focus to the (still hidden) console window for that subprocess,
simulates the user typing Ctrl-C (or Ctrl-Break in some versions), then
switches focus back to Emacs.  The focus switching is reflected in the
title bar being redrawn as inactive then active again.

>Is this a known problem or common mistake?  Did I just miss something in 
>the NTEmacs FAQ or the CygWin FAQ?

As you've said in another post, this only happens with the 1.x releases
of Cygwin.  They've obviously changed their signal handling in some way
since b20 that causes Emacs' efforts to be ignored.  Even the
alternative method left over from early versions of Emacs (available by
setting `w32-start-process-share-console' to t) doesn't work.  (That
method uses the Windows GenerateConsoleCtrlEvent API.)

I assume bash ignores these console control events because its stdin is
a pipe, and not attached to the console.  Unfortunately, I don't know of
any solution to the problem (short of building Emacs with cygwin so it
can use cygwin's private mechanisms for emulating Unix pty's).

If anyone has the time and inclination to look into what is happening in
cygwin when a CONSOLE_CTRL_C_EVENT is received by bash, when its stdin
is not a tty, it would be very helpful.  A patch to make it work again
would be even better.  [I've copied this mail to cygwin@cygwin.com.]


Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list