delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/11/30/11:31:35

X-Spam-Check-By: sourceware.org
Message-ID: <456F0753.78B7CC9B@dessent.net>
Date: Thu, 30 Nov 2006 08:31:15 -0800
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: Simon Marlow <simonmar AT microsoft DOT com>
CC: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Re: Ctrl-C and non-cygwin programs
References: <A50988F69402FB47B4D860B67FB51FA13462F87C AT EA-EXMSG-C311 DOT europe DOT corp DOT microsoft DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
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

Simon Marlow wrote:

> Then run the program, hit Ctrl-C and see what happens.  The behaviour differs depending on the environment:
> 
>   * In a Cygwin shell started from cygwin.bat, with the CYGWIN
>     environment variable empty: correct behaviour, Ctrl-C is caught
>     and handled.
> 
>   * In a Cgwin shell started from cygwin.bat, with CYGWIN=tty:
>     Ctrl-C apparently just kills the child process, the event is
>     not caught.
> 
>   * In an xterm (Cygwin), with Cygwin bash: again, the child process
>     is just killed.
> 
>   * In a CMD.EXE shell, Ctrl-C is caught and handled.

The problem is that in the case of CYGWIN=tty or under xterm/rxvt, the
program is not attached to a Windows console at all.  It is running
under a Cygwin pseudoterminal (pty), which to a non-Cygwin app will look
as if it was totally detached with just pipes connected to stdin and
stdout.  Since there's no console, there's no way for a
ConsoleCtrlHandler event to fire.

Brian

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