Web lists-archives.com

Re: Unattended upgrade does not report errors via the exit code




Greetings, Ken Brown!

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

Karmaoverflow is not the authoritative source of information.
The key word is "directly in the command line". CMD checks if application you
are starting is console or not and abandon process control for perceived GUI
apps.
But if you run application from batch file, it will treat all of them equal.

> but it is true if the
> application is started via 'start /wait'.  I haven't tested this.

Unless application explicitly detach from parent process, or parent process
explicitly exec the child with no process control, there's no difference.
exit(n) is the same function, not dependent on the type of application.


-- 
With best regards,
Andrey Repin
Thursday, July 5, 2018 14:08:05

Sorry for my terrible english...