| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Spam-Check-By: | sourceware.org |
| From: | "greg" <gregorys AT mips DOT com> |
| To: | <cygwin AT cygwin DOT com> |
| Cc: | <"macro AT mips DOT com"@delorie.com> |
| Subject: | SIGINT handler not called during blocking pipe read |
| Date: | Fri, 12 Oct 2007 10:26:25 -0400 |
| Message-ID: | <PJEDIAJFFCEEKLEEKMBCCEBICMAA.gregorys@mips.com> |
| MIME-Version: | 1.0 |
| X-Mailer: | Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) |
| 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'm trying to use a Cygwin-linked program as a subprocess in Eclipse.
As spawned in this environment, if a SIGINT is sent to the process when
it is blocked reading from stdin (connected to a pipe in this case), the
SIGINT handler is not being called.
In an attempt to reduce the scenario to its essentials, I was able to
replicate the symptoms with a minimal outside-of-Eclipse scenario below.
Is this expected behavior with respect to SIGINT during a pipe read?
--
/*
* File name: catchsigint.c
*
* A pared-down example illustrating SIGINT handler not being
* called when SIGINT received while process is blocked waiting
* for a read from pipe.
*
* The symptoms are seen with Cygwin 1.5.24-2 as well as earler
* versions, on Windows XP+SP2 and Win2K.
*
* To build: gcc -o catchsigint.exe catchsigint.c
*
* Steps to reproduce symptoms:
*
* 1) From the Windows Start menu, open a native Windows command
* prompt.
*
* 2) Launch this example program (catchsigint.exe) from the native
* Windows command prompt, with stdin coming from a pipe.
*
* C:\temp>cat | catchsigint
*
* 3) As the catchsigint process is blocked waiting for input from
* the pipe, send SIGINT to the catchsigint process via
* "kill -SIGINT pid" from a Cygwin shell.
*
*/
#include <stdio.h>
#include <signal.h>
void handler(int sig) {
printf("SIGINT caught\n");
exit(-1);
}
int main() {
signal(SIGINT, handler);
/* The following sets up a blocking read,
then we'll send a SIGINT from outside */
getchar();
return 0;
}
--
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |