X-Recipient: archive-cygwin@delorie.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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; q=dns; s=default; b=ct
	A9jD9PTu7QuJRbfF+Ysku4Nr+sNqYLUKpNf/nv0fuqf5fGcwtx3vaS/LsDeftxk5
	lTmvtiZvJ5NhMrdMjlM7Timg84mRJXjTM+4ZGwuwHSr/3ME2pAuLReGndjjdGMqE
	7svFmzbBoKNsteSHj3VhHjqUlLdF8BWTmT14Kbcgw=
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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; s=default; bh=esUJMcJ6
	/6cXUm+dCsvx0oG85Uk=; b=VtadVcwdiejnMzXO1/wq7uXmuRrpQN1IhGbiNs5T
	1t3XYwbWlgglSn+uY3sy48XBvSjHmWIGG5JcIpbNqMfbxOA5BZFKTWoaUfgHWwYR
	518Bo9grc1Z/DiyW8oD20a1wx1g7IueesNBIcdpzBqrEEk4HdVsKpP8L/U+764mW
	XBI=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-qa0-f46.google.com
MIME-Version: 1.0
X-Received: by 10.224.32.133 with SMTP id c5mr4179656qad.84.1381502567494; Fri, 11 Oct 2013 07:42:47 -0700 (PDT)
In-Reply-To: <0D835E9B9CD07F40A48423F80D3B5A7028690FDD@USA7109MB022.na.xerox.net>
References: <5257FE1A.5050905@cygwin.com>	<0D835E9B9CD07F40A48423F80D3B5A7028690FDD@USA7109MB022.na.xerox.net>
Date: Fri, 11 Oct 2013 10:42:47 -0400
Message-ID: <CA+sc5mm2kJSZFDeQVcunqXw57FPfMcNsbp-sV4YUECHxfqd-gg@mail.gmail.com>
Subject: Re: ERRORLEVEL not returning to Cygwin shell
From: Earnie Boyd <earnie@users.sourceforge.net>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes

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.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

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

