Simon Marlow wrote: > Then run the program, hit Ctrl-C and see what happens. The behaviour differs > depending on the environment: > > * In a Cygwin shell started from cygwin.bat, with the CYGWIN > environment variable empty: correct behaviour, Ctrl-C is caught > and handled. > > * In a Cgwin shell started from cygwin.bat, with CYGWIN=tty: > Ctrl-C apparently just kills the child process, the event is > not caught. > > * In an xterm (Cygwin), with Cygwin bash: again, the child process > is just killed. > > * In a CMD.EXE shell, Ctrl-C is caught and handled.
The problem is that in the case of CYGWIN=tty or under xterm/rxvt, the program is not attached to a Windows console at all. It is running under a Cygwin pseudoterminal (pty), which to a non-Cygwin app will look as if it was totally detached with just pipes connected to stdin and stdout. Since there's no console, there's no way for a ConsoleCtrlHandler event to fire. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/