delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/01/20:39:46

From: "Steve Ball" <steve AT effectivejava DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: system() hangs or returns incorrect value when child process killed
Date: Sun, 2 Jan 2000 12:06:51 +1300
Organization: Customer of Telecom Internet Services
Lines: 35
Message-ID: <84m1ad$pbis$1@titan.xtra.co.nz>
NNTP-Posting-Host: 203-96-93-26.dialup.xtra.co.nz
X-Trace: titan.xtra.co.nz 946768013 831068 203.96.93.26 (1 Jan 2000 23:06:53 GMT)
X-Complaints-To: abuse AT xtra DOT co DOT nz
NNTP-Posting-Date: 1 Jan 2000 23:06:53 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Does anyone know a workaround for this bug?

If the child process is killed using ^C or ^-Break, system() should return a
value with SIGINT in bits 8-17.

I get varying results depending on the child process:

1. If the child process is a .COM file (such as CHOICE.COM), the return
value
   is zero.

2. More importantly, if it is a DJGPP-compiled program, the return value is
   255 (as if the process had terminated by calling exit(255)).

3. If the command line is "DELTREE \SOMEDIR", killing the child process with
   ^C hangs the DOS session (this works okay if entered from the shell).

errno is not set in any of these cases (well, it may be set in the last
case,
but it's very hard to tell).

The problem appears to be originating in the spawn() family of functions
(they give the same results).

I have posted this buf to the DJGPP bug list
(http://www.delorie.com/djgpp/bugs/show.cgi?000311) but, right now, I'm keen
to find a workaround...

How can I tell if a child process was terminated (so the parent can
terminate too)?

Any help would be appreciated. Thanks.



- Raw text -


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