delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/10/11/13:24:29

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:reply-to:mime-version:to
:subject:references:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=x7FhmO8uyzi0VwI6
F7hkALDHoEu6/wgJadUe4bwI7Hr/qskM7LpL/SaKJGAZpsfUHt8IEAgfPAoh6wBU
E38la/d20bwXlGy6iRhTBBvfOeznck2T1VQLrX2HesQax2cD2Q9mbB+2OU1MW7GA
nBVnPd1M1WtYsWAmApAiwnLYEJ4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:reply-to:mime-version:to
:subject:references:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=5iJ+iRNZ4NYdx4NuDTGRk3
adYRA=; b=qeMX37KZV8cgLRKyCB0TZ6oQsJgu1lh42dCvN1hoYKEfuvDQD+aIKs
w4yVFyZI/HVVuuIcMJoWOUuLOCsJSA5q5DcUcHzB8St42wm9MriIHP9HH6J92Hq7
KMJyUqvdDCb4Rhxywlcyo5jtx/Oqu428KRM69sYyJZtVodJOxC0hQ=
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2
X-HELO: vms173013pub.verizon.net
Message-id: <52583438.8040207@cygwin.com>
Date: Fri, 11 Oct 2013 13:24:08 -0400
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-to: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0
MIME-version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: ERRORLEVEL not returning to Cygwin shell
References: <5257FE1A DOT 5050905 AT cygwin DOT com> <0D835E9B9CD07F40A48423F80D3B5A7028690FDD AT USA7109MB022 DOT na DOT xerox DOT net> <CA+sc5mm2kJSZFDeQVcunqXw57FPfMcNsbp-sV4YUECHxfqd-gg AT mail DOT gmail DOT com> <20131011155327 DOT GA2240 AT ednor DOT casa DOT cgf DOT cx>
In-reply-to: <20131011155327.GA2240@ednor.casa.cgf.cx>

On 10/11/2013 11:53 AM, Christopher Faylor wrote:
> On Fri, Oct 11, 2013 at 10:42:47AM -0400, Earnie Boyd wrote:
>> On Fri, Oct 11, 2013 at 10:35 AM, Nellis, Kenneth wrote:
>>>> From: Larry Hall (Cygwin)
>>>>
>>>> On 10/11/2013 8:27 AM, paul hermeneutic wrote:
>>>>> I am using CYGWIN_NT-5.1 PAC047922 1.7.25(0.270/5/3) 2013-08-31 20:39
>>>>> i686 Cygwin
>>>>>
>>>>> An exit code returned by a DOS batch file does not seem to be coming
>>>>> back to the Cygwin shell. I am using bash.
>>>>>
>>>>> $ cat myexit.bat
>>>>> @echo off
>>>>> set EXITCODE=%1
>>>>> echo got here with %1
>>>>> exit /b %EXITCODE%
>>>>>
>>>>> $ cmd /c c:/DOCUME~1/pwatson/bin/myexit.bat 8
>>>>> got here with 8
>>>>>
>>>>> $ echo $?
>>>>> 0
>>>>
>>>> WJFFM.  Same version, same arch.  Guess you need to do some more digging.
>>>
>>> FWIW, I get the same results as the OP:
>>>
>>> $ cat myexit.bat
>>> @echo off
>>> set EXITCODE=%1
>>> echo got here with %1
>>> exit /b %EXITCODE%
>>> $ cmd /c myexit.bat 8
>>> got here with 8
>>> $ echo $?
>>> 0
>>> $ uname -r
>>> 1.7.25(0.270/5/3)
>>> $
>>>
>>> For grins, I tried with both Unix and DOS line endings. Made no difference.
>>
>> Cygwin has no control and loses all communication with the cmd.exe
>> child process.  How is it supposed to return anything other than an
>> exit code of 0 because cmd.exe exited normally.  You simply cannot mix
>> Windows and Cygwin like this.
>
> exit /b seems to cause CMD to exit with that value.  It does for me:
>
>    % cmd /c myexit.bat 9; echo SAW $?
>    got here with 9
>    SAW 9
>
> This is on Windows 7 64.  Maybe other versions of Windows differ.

Don't know if it's significant or not but I'm running W7 64 too,
running Cygwin 32bit.


-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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