This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bash, Windows Console programs, and Ctrl-C


Hi,

I am using Cygwin on Windows 2000.

I am running Win32 command-line programs from bash. In
these programs, I'd like to react to Ctrl-C, using Win32's
SetConsoleCtrlHandler() function.

See, for example, the attached program (compile with MinGW
or MS C++): When pressing Ctrl-C, I expect the program to
continue. For demonstration, it should print "Sleeping ...",
and wait for a while, before exiting.

This works fine when I run the program from a Windows "cmd"
command-line shell.

It does not work when I run the program from Cygwin's bash:
sometimes, I see the "Sleeping" message, but then the program
is interrupted, and never completes cleanly.

This almost looks as if the program is sent a separate signal,
but adding a signal handler (using signal (SIGINT, ...);) does
not make a difference.

"stty intr ^y" also did not have an effect.

Any suggestions?

Thanks,
Frank

Attachment: ctrlc.cpp
Description: ctrlc.cpp

--
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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]