Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <00f201c18922$2783b180$c51811ac@brokat.de> From: "Michael Rumpf" To: Subject: bash/cmd CTRL-C problem... Date: Thu, 20 Dec 2001 07:47:12 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Hi, I'm new to the list and I don't know if this problem is already solved, but I couldn't find a hint neither on the archives nor on the FAQ or somewhere else on the net. My problem is related to bash/cmd and signal handling. In my app I installed a signal handler for SIGINT. The app is going into a wait loop and waiting for the exit flag from the signal handler to be set. When pressing CTRL-C in the windows cmd shell the application continues normally after the signal handler has been caught. Under bash the signal handler is also correctly called, but after that the app is exiting immediatly, i.e. not continuing with the code. Here is the source: //////////////////////////////////////////////////////////////////////////// ///////////////// #include #include #include bool loop = true; extern "C" void signalHandler(int sig) { switch( sig ) { case SIGINT: // == 2 printf("SIGINT=%d\n",sig); break; default: printf("default=%d\n",sig); break; }; loop=false; } int main(int argc, char* argv[]) { if (signal( SIGINT , signalHandler ) == SIG_ERR) return -1; printf("### ctrlbreak: Waiting now...\n"); while(loop) Sleep ((DWORD) 1000) ; printf("### ctrlbreak: Finished waiting now...\n"); return 0; } //////////////////////////////////////////////////////////////////////////// ///////////////// Here the the output of the app under Win2K/bash: // bash 2.05a-2 $ ./ctrlbreak.exe ### ctrlbreak: Waiting now... SIGINT=2 // GNU bash, version 2.02.1(2)-release (i586-pc-cygwin32) B20.1 bash-2.02$ ./ctrlbreak ### ctrlbreak: Waiting now... SIGINT=2 // cmd.exe Win2k SP2 ### ctrlbreak: Waiting now... SIGINT=2 ### ctrlbreak: Finished waiting now... You can see that under the cmd shell the text "Finished waiting now..." is printed which does not come out under the bash. The app is not linked against any cygwin library. It is a plain VC++ console application. But when I compile with gcc from the cygwin package I have the same result. Any hint would be greatly appreciated... Michael PS: I just downloaded the latest stable version 1.3.6 today... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/