delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/22/16:57:33

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4978EBF0.3090104@gmail.com>
Date: Thu, 22 Jan 2009 21:58:08 +0000
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Signal handling in WIN32 console programs
References: <20090119164151 DOT GA28574 AT certicom DOT com>
In-Reply-To: <20090119164151.GA28574@certicom.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

avadekar AT certicom DOT 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.

Andy


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019