mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-07 11:46:22 +02:00
Introduced ExceptionExitCode
git-svn-id: trunk@33052 -
This commit is contained in:
parent
aa0ec8c0e5
commit
ee8652a983
@ -40,6 +40,7 @@ Type
|
|||||||
FOptionChar : Char;
|
FOptionChar : Char;
|
||||||
FCaseSensitiveOptions : Boolean;
|
FCaseSensitiveOptions : Boolean;
|
||||||
FStopOnException : Boolean;
|
FStopOnException : Boolean;
|
||||||
|
FExceptionExitCode : Integer;
|
||||||
function GetEnvironmentVar(VarName : String): String;
|
function GetEnvironmentVar(VarName : String): String;
|
||||||
function GetExeName: string;
|
function GetExeName: string;
|
||||||
Function GetLocation : String;
|
Function GetLocation : String;
|
||||||
@ -64,6 +65,7 @@ Type
|
|||||||
procedure Run;
|
procedure Run;
|
||||||
procedure ShowException(E: Exception);virtual;
|
procedure ShowException(E: Exception);virtual;
|
||||||
procedure Terminate; virtual;
|
procedure Terminate; virtual;
|
||||||
|
procedure Terminate(AExitCode : Integer) ; virtual;
|
||||||
// Extra methods.
|
// Extra methods.
|
||||||
function FindOptionIndex(Const S : String; Var Longopt : Boolean; StartAt : Integer = -1) : Integer;
|
function FindOptionIndex(Const S : String; Var Longopt : Boolean; StartAt : Integer = -1) : Integer;
|
||||||
Function GetOptionValue(Const S : String) : String;
|
Function GetOptionValue(Const S : String) : String;
|
||||||
@ -97,6 +99,7 @@ Type
|
|||||||
Property OptionChar : Char Read FoptionChar Write FOptionChar;
|
Property OptionChar : Char Read FoptionChar Write FOptionChar;
|
||||||
Property CaseSensitiveOptions : Boolean Read FCaseSensitiveOptions Write FCaseSensitiveOptions;
|
Property CaseSensitiveOptions : Boolean Read FCaseSensitiveOptions Write FCaseSensitiveOptions;
|
||||||
Property StopOnException : Boolean Read FStopOnException Write FStopOnException;
|
Property StopOnException : Boolean Read FStopOnException Write FStopOnException;
|
||||||
|
Property ExceptionExitCode : Longint Read FExceptionExitCode Write FExceptionExitCode;
|
||||||
Property EventLogFilter : TEventLogTypes Read FEventLogFilter Write FEventLogFilter;
|
Property EventLogFilter : TEventLogTypes Read FEventLogFilter Write FEventLogFilter;
|
||||||
Property SingleInstance: TBaseSingleInstance read GetSingleInstance;
|
Property SingleInstance: TBaseSingleInstance read GetSingleInstance;
|
||||||
Property SingleInstanceClass: TBaseSingleInstanceClass read FSingleInstanceClass write SetSingleInstanceClass;
|
Property SingleInstanceClass: TBaseSingleInstanceClass read FSingleInstanceClass write SetSingleInstanceClass;
|
||||||
@ -311,7 +314,7 @@ begin
|
|||||||
FOnException(Sender,Exception(ExceptObject));
|
FOnException(Sender,Exception(ExceptObject));
|
||||||
end;
|
end;
|
||||||
If FStopOnException then
|
If FStopOnException then
|
||||||
FTerminated:=True;
|
Terminate(ExceptionExitCode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -358,8 +361,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomApplication.Terminate;
|
procedure TCustomApplication.Terminate;
|
||||||
|
begin
|
||||||
|
Terminate(0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomApplication.Terminate(AExitCode : Integer) ;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FTerminated:=True;
|
FTerminated:=True;
|
||||||
|
If (AExitCode<>0) then
|
||||||
|
ExitCode:=AExitCode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomApplication.GetOptionAtIndex(AIndex : Integer; IsLong: Boolean): String;
|
function TCustomApplication.GetOptionAtIndex(AIndex : Integer; IsLong: Boolean): String;
|
||||||
|
Loading…
Reference in New Issue
Block a user