delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/03/13:49:27

From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: system() hangs or returns incorrect value when child process killed
Date: Mon, 3 Jan 2000 11:02:38 +0200
Organization: NetVision Israel
Lines: 42
Message-ID: <Pine.SUN.3.91.1000103105805.14725L-100000@is>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000102112005 DOT 1710e-100000 AT is> <k7Qb4.2841$W41 DOT 58040 AT dfiatx1-snr1 DOT gtei DOT net>
NNTP-Posting-Host: is.elta.co.il
Mime-Version: 1.0
X-Trace: news.netvision.net.il 946890359 18217 199.203.121.2 (3 Jan 2000 09:05:59 GMT)
X-Complaints-To: abuse AT netvision DOT net DOT il
NNTP-Posting-Date: 3 Jan 2000 09:05:59 GMT
X-Sender: eliz AT is
In-Reply-To: <k7Qb4.2841$W41.58040@dfiatx1-snr1.gtei.net>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 2 Jan 2000, Damian Yerrick wrote:

> > I didn't see any bugs in what you describe.  It's all expected
> > behavior.
> 
> Or as Micro$oft Knowledge Base states it:
> "This behavior is by design." It's not a bug; it's a feature.

I protest the comparison ;-)

Seriously, though: unlike Microsoft, I submit that DJGPP features are 
mostly just that: features, not misfeatures.  There are a few problems 
where the basic deficiency of the underlying OS is so staggering and hard 
to fix that DJGPP just punts.  But these cases are very rare, and, unlike 
Microsoft, the sources are there to study, improve and/or hack.

> > In general, pressing ^C while the child program runs delivers the
> > signal SIGINT to its parent(s) as well, so the parent doesn't need to
> > do anything to terminate: it will be aborted automatically once the
> > child exits.
> 
> So if a program catches SIGINT and maps it to Edit > Copy,
> then it will abort the parent when it's done?

If the parent is a DJGPP program, yes.

If the parent doesn't want to be aborted, it needs to install a
handler for SIGINT which overrides the default behavior.  The handler
can be SIG_IGN in the simple cases, when you only want to ignore
SIGINT while the child runs, or it could be something more complex,
like popping a message about interrupted child (that's what Make does,
for example).

Of course, you should remember to restore the old SIGINT handler once
the child program exits.

Btw, this ``inheritance'' of signals is really a feature: it exists
because SIGINT and SIGQUIT are generated by a keyboard interrupt
handler which chains to the previous handler, and it was left like
this because on Unix, *all* signals are passsed up the child-parent
chain.

- Raw text -


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