Subject: Re: NTEmacs shell with CygWin: control-C problem
From: Andrew Innes <[email-masked]>
To: Daniel Barclay <[email-masked]>
Cc: [email-masked], [email-masked]
Date: 19 Jan 2001 14:20:11 +0000

On Thu, 11 Jan 2001 17:19:17 -0500, Daniel Barclay <[email-masked]> said:
>I'm having trouble with killing commands with control-C in a shell
>buffer.
>
>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 [email-masked].]

AndrewI

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