[Lazarus] Exit Status of Lazarus App

Sven Barth pascaldragon at googlemail.com
Thu Mar 21 22:06:11 CET 2013


On 21.03.2013 22:00, Mark Morgan Lloyd wrote:
> David Copeland wrote:
>
>> As an aside, I have discovered that if you use FpSystem to run a Lazarus
>> App, the exit code returned is multiplied by 256 (or mishandled
>> somehow), Eg. 1 => 256, 13 => 3328, etc. However when run using TProcess
>> the exit code is returned correctly.
>
> Working from memory I think that's by design, it's the way the unix
> system calls work.
>

According to the man page you are right. The man page of "system" refers 
to "5 wait" regarding the exitstatus which mentions that you should use 
the macro "WEXITSTATUS(status)" to get the exitcode which will return 
(according to its implementation) return the upper 8 bits of the status 
(which is a 16 bit value).

Regards,
Sven




More information about the Lazarus mailing list