Skip to content

Commit

Permalink
refactor: Stop before Dispatch if App Terminated
Browse files Browse the repository at this point in the history
  • Loading branch information
gcarreno committed Sep 25, 2023
1 parent 85274af commit ca77ed9
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions examples/CLI/polykermacli.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,19 @@ procedure TPolyKermaCLI.DoRun;
begin
LoadParams;

PolyKermaSetup;
{$IFDEF UNIX}
if FpSignal(SigInt, @HandleSigInt) = signalhandler(SIG_ERR) then begin
Error({$I %FILE%}, {$I %LINE%}, Format('Failed to install signal error: %d', [ fpGetErrno ]));
Halt(1);
if not Terminated then
begin
PolyKermaSetup;
{$IFDEF UNIX}
if FpSignal(SigInt, @HandleSigInt) = signalhandler(SIG_ERR) then begin
Error({$I %FILE%}, {$I %LINE%}, Format('Failed to install signal error: %d', [ fpGetErrno ]));
Halt(1);
end;
{$ENDIF UNIX}

FDispatcher.Run(True);
PolyKermaTearDown;
end;
{$ENDIF UNIX}

FDispatcher.Run(True);
PolyKermaTearDown;

// stop program loop
Terminate;
Expand Down

0 comments on commit ca77ed9

Please sign in to comment.