[Lazarus] Exit Status of Lazarus App

David Copeland david.copeland at jsidata.ca
Thu Mar 21 21:03:03 CET 2013


On 03/21/2013 12:05 PM, Mark Morgan Lloyd wrote:
> Sven Barth wrote:
>> Am 21.03.2013 14:23, schrieb David Copeland:
>>> Hi,
>>>
>>> How can I set the exit status/return code of a Lazarus application? I
>>> have done some searching but haven't found it.
>> The variable you are looking for is called "ExitCode" (and as it is
>> in unit System it's always available). See here:
>> http://www.freepascal.org/docs-html/rtl/system/exitcode.html
>
> Thanks for that as well. I've experimentally put it in a signal
> handler (that otherwise has the effect of setting a flag which is
> checked at an opportune point in the code) and can confirm it works.
> Also OK in an OnCloseQuery handler etc.
>

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.

Dave.





More information about the Lazarus mailing list