delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/18/14:46:06

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Wed, 18 Apr 2001 22:43:56 +0400
From: egor duda <deo AT logos-m DOT ru>
X-Mailer: The Bat! (v1.45) Personal
Reply-To: egor duda <cygwin AT cygwin DOT com>
Organization: deo
X-Priority: 3 (Normal)
Message-ID: <31355732075.20010418224356@logos-m.ru>
To: "Tim Baker" <dbaker AT direct DOT ca>
CC: cygwin AT cygwin DOT com
Subject: Re: cygwin apps in pipe ignore ctrl+c
In-reply-To: <002901c0c833$d32553a0$3e8a42d8@hpcustomer>
References: <002101c0c82e$8206abe0$3e8a42d8 AT hpcustomer>
<2352393414 DOT 20010418214818 AT logos-m DOT ru>
<002901c0c833$d32553a0$3e8a42d8 AT hpcustomer>
Mime-Version: 1.0

Hi!

Wednesday, 18 April, 2001 Tim Baker dbaker AT direct DOT ca wrote:

>> TB> I have a console app MyApp which runs in a pipe. MyApp calls
>> TB> CreateProcess() to launch OtherApp and later calls
>> TB> GenerateConsoleCtrlEvent() to send Ctrl+C to OtherApp. When
>> TB> OtherApp is non-Cygwin it is interrupted cleanly just as though
>> TB> the user had typed Ctrl+C from in the DOS window. But when
>> TB> OtherApp is a Cygwin application it ignores any number of
>> TB> CTRL_C_EVENTs I send and continues running. So a Cygwin
>> TB> app must be calling SetConsoleCtrlHandler() to intercept the
>> TB> CTRL_C_EVENT but for some reason it is not behaving properly
>> TB> when the Cygwin app is *running in a pipe*. (The Cygwin app IS
>> TB> attached to a Win32 console window which is required for
>> TB> GenterateConsoleCtrlEvent() to work.)
>> 
>> use kill() function to interrupt cygwin application. this is a normal
>> unix way to do such things.

TB> Sure, but I do not know if OtherApp is going to be a Cygwin app or not.
TB> Sometimes it is not, so calling Cygwin's kill() might not be appropriate.

you can do (for example) something like this:

  signal (SIGCHLD, process_sigchld);
  kill (child_pid, SIGTERM);
  sleep (1);
  if (!child_exited)
    use_win32_methods_to_terminate_child ();

TB> In any event, this bug effects typing Ctrl+C in a console window too.
TB> When I run "gcc -pipe file.c" and CPP is running, I type Ctrl+C and
TB> CPP does not die. I then type Ctrl+Alt+Del to see the running tasks
TB> and GCC is gone but not CPP (CPP continues running then exits).

can you provide simple testcase?

Egor.            mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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