delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/19/10:57:42

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: Sat, 19 May 2001 10:57:13 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: spawnl and signals
Message-ID: <20010519105713.A7329@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <200105191450 DOT PAA05445 AT malus DOT maths DOT soton DOT ac DOT uk>
Mime-Version: 1.0
User-Agent: Mutt/1.3.11i
In-Reply-To: <200105191450.PAA05445@malus.maths.soton.ac.uk>; from J.L.Moxham@maths.soton.ac.uk on Sat, May 19, 2001 at 03:50:37PM +0100

On Sat, May 19, 2001 at 03:50:37PM +0100, Jason Moxham wrote:
>
>If you compile and run program below with latest cygwin you get the
>expected behavour
>
>// This is jay.exe
>
>#include <stdio.h>
>#include <stdlib.h>
>#include <signal.h>
>
>volatile int gotsignal=0;
>
>void	sighandler(int signum){gotsignal=signum;return;}
>
>int	main(void)
>{int a;
>
>printf("in jay.exe\n");fflush(0);
>signal(SIGINT,sighandler);
>do{
>if(gotsignal!=0)
>  {printf("got signal %d\n",gotsignal);
>   fflush(0);
>   gotsignal=0;break;}
>}while(1);
>return 0;}
>
>However if you compile and run the program below which calls the above
>program then the ctrl-C signal is never detected
>
>// this is jay1.exe
>
>#include <stdio.h>
>#include <stdlib.h>
>#include <signal.h>
>#include <process.h>
>
>volatile int gotsignal=0;
>
>void	sighandler(int signum){gotsignal=signum;return;}
>
>int	main(void)
>{int a;
>
>spawnl(_P_NOWAIT,"./jay.exe","./jay.exe",0);
>//execl("./jay.exe","./jay.exe",0);
>
>return 0;}
>
>this is running under Window 98SE under a DOS prompt
>changing the spawnl to a execl makes it work as it should

P_NOWAIT starts a background process.  Background processes don't
respond to CTRL-Cs.  It is the same as if you typed "jay.exe&" in bash.
If you send a specific SIGINT to the process it should stop though.

cgf

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