From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2093 invoked by alias); 22 Jan 2009 22:04:38 -0000 Received: (qmail 2083 invoked by uid 22791); 22 Jan 2009 22:04:38 -0000 X-Spam-Check-By: sourceware.org Received: from pool-71-126-240-83.bstnma.fios.verizon.net (HELO cgf.cx) (71.126.240.83) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Jan 2009 22:04:33 +0000 Received: from ednor.cgf.cx (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id 6DD5E13C029 for ; Thu, 22 Jan 2009 17:04:23 -0500 (EST) Received: by ednor.cgf.cx (Postfix, from userid 201) id 4EA132B385; Thu, 22 Jan 2009 17:04:23 -0500 (EST) Date: Thu, 22 Jan 2009 23:21:00 -0000 From: Christopher Faylor To: cygwin@cygwin.com Subject: Re: Signal handling in WIN32 console programs Message-ID: <20090122220422.GA19936@ednor.casa.cgf.cx> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20090119164151.GA28574@certicom.com> <4978EBF0.3090104@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4978EBF0.3090104@gmail.com> User-Agent: Mutt/1.5.16 (2007-06-09) Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2009-01/txt/msg00692.txt.bz2 On Thu, Jan 22, 2009 at 09:58:08PM +0000, Andy Koppe wrote: > avadekar@certicom.com wrote: >>My WIN32 app is compiled under vc7 and uses signal() to trap SIGINT, >>SIGABRT and SIGTERM. If I run the application under console2 or a >>native terminal, pressing ^C triggers the handler and the application >>stops programmatically due to a state change made by the handler. When >>I do the same under rxvt (not the X based one) or minTTY, the ^C stops >>the process without the signal handler executing. Similarly, even when >>run from the native console, kill (-INT, -ABRT, -TERM) causes the >>application to end without the handler catching the signal. So I >>wonder if the native console passes the character to the process >>directly whereas the minTTY/rxvt shells interpret it and send a signal >>that the native app doesn't really understand properly. > >MinTTY and rxvt do not interpret the ^C keypress in any special way. >They simply write a ^C (0x03) character to the child process' pty. The >pty driver may translate that into a signal depending on the pty's line >settings (as shown by stty). Sorry I don't know how ^C is processed in >a Windows console or why the behaviour would be different with ptys. The operative term here is, once again, "Windows Console". A pure Windows program running in MinTTY or rxvt does not have a windows console and so won't see the type of SIGINT that the windows console generates. cgf -- 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/