www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/19/11:42:18

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=BAYES_05
X-Spam-Check-By: sourceware.org
Date: Mon, 19 Jan 2009 11:41:51 -0500
From: avadekar AT certicom DOT com
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Signal handling in WIN32 console programs
Message-ID: <20090119164151.GA28574@certicom.com>
Reply-To: avadekar AT certicom DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.4.2.3i
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

I ran across something under minTTY that I've confirmed behaves the same way
in rxvt, but differs under both the native terminal and console2.  I expect
there is a good reason why this happens, and I'm quite willing to modify the
WIN32 app rather than pine for a change in minTTY to accomodate me.

But first I need to understand what is really happening and how I could deal
with it.

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.

If so, is there anything I can do within the WIN32 app to catch what is
getting to it from the signal and maintain programmatic control?


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