www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/25/18:40:13

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
content-class: urn:content-classes:message
Subject: some Win32 exit codes become 0
MIME-Version: 1.0
Date: Tue, 25 Jun 2002 15:39:53 -0700
Message-ID: <2D9D5132D9067C49A484611CD8CE08D469F7A1@VELOCE.performant.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Ted Romer" <Ted DOT Romer AT performant DOT com>
To: <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g5PMeDu01972

In cygwin-1.3.11-3, if I invoke a Win32 process that exits with negative status (or status >= 256), cygwin converts the status to 0.  

Good practice or not, programs often use -1 as an exit status indicating failure, so this makes error checking challenging.

Easy to reproduce:

% perl -e 'exit(-1)'
% echo $?
0
% jython nosuchscript.py
% echo $?
0

The cause is that sigproc.cc:stopped_or_terminated assumes that the EXIT_SIGNAL bit in the exit code in fact indicates that the process exited due to a signal.  This is true for cygwin processes, but not for Win32 processes.

There is no nice fix that I can think of, since there isn't a clean mapping from Win32 exit codes to cygwin exit codes.  I'd be happy with any solution that mapped non-zero Win32 exit codes to non-zero cygwin exit codes.

Ted Romer


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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