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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=SJGcyDalgHIpKZuC
	yGRJuK//J1hheEaeliydJJz0J2asRLIIdHhpUS0/dMNTD4EdAsrcGrDqnCikrwD6
	P1Ojl9T1trJ5elBVqUJ1kzVkqmt9VY9hrbYPrqMbEl4Hs9R+SkGrgPf6EVV6jZtv
	xNUvAtMi/wDYUZ9CbKYqIDsaPgM=
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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=d5Zj3M6SsMRJiXC5UXfK6a
	Jg8wA=; b=Ae/bUbLW7EJPTLZefsaWnKwhIH4j2UiSbVbN5ZjswqvN+bf+w/Xsv0
	lNIj/UcrIR3Gkpdlm+MSNf7DpmQYZtMIDdeNlapFeMN0UYZELoyZ4XpuzMYupleF
	RYUwUi6GshYvdTlDRkOZLwSRo2J1UWUNZd3iSc0L9wix0MOy5UzgA=
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-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit
X-HELO: limerock03.mail.cornell.edu
Subject: Re: Unattended upgrade does not report errors via the exit code
To: cygwin@cygwin.com
References: <693796192.3838665.1530640512441.ref@mail.yahoo.com> <693796192.3838665.1530640512441@mail.yahoo.com> <126e0d40-4dd2-126d-b54c-7ddc27d008b8@cornell.edu> <7a9215c3-a895-b935-a843-e47b4135f138@tiscali.co.uk>
From: Ken Brown <kbrown@cornell.edu>
Message-ID: <161257fb-c7e8-e767-752f-40dc367cf7bf@cornell.edu>
Date: Wed, 4 Jul 2018 23:16:21 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0
MIME-Version: 1.0
In-Reply-To: <7a9215c3-a895-b935-a843-e47b4135f138@tiscali.co.uk>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-IsSubscribed: yes

On 7/4/2018 6:25 PM, David Stacey wrote:
> On 04/07/18 19:59, Ken Brown wrote:
>> On 7/3/2018 1:55 PM, R. Diez via cygwin wrote:
>>> I tried printing $? from a Cygwin shell afterwards, and %ERRORLEVEL% 
>>> in a Windows console, and it always showed an exit status of 0.
>>
>> setup is a Windows program, not a Cygwin application, so I don't think 
>> you can expect $? to contain its exit status.  I don't know enough 
>> about Windows programming to know what would have to be changed in the 
>> setup sources to support %ERRORLEVEL%.
> 
> %ERRORLEVEL% is the return code from the last programme or script to 
> execute. Provided that setup exits with zero on success and non-zero on 
> an error condition, there's nothing extra to be done.

According to 
https://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line/11476681#11476681, 
that's not true for windowed applications, but it is true if the 
application is started via 'start /wait'.  I haven't tested this.

Ken


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

