mirror of https://gitlab.com/basile.b/dexed.git
improved DCD life-time management
- if server already running then use current - if already running then don't kill on exit
This commit is contained in:
parent
b36a5af627
commit
294994dfc5
|
|
@ -5,7 +5,7 @@ unit ce_dcd;
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, process, forms, strutils,
|
Classes, SysUtils, process, forms, strutils, windows,
|
||||||
ce_common, ce_writableComponent, ce_interfaces, ce_observer, ce_synmemo, ce_project;
|
ce_common, ce_writableComponent, ce_interfaces, ce_observer, ce_synmemo, ce_project;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
@ -20,6 +20,7 @@ type
|
||||||
private
|
private
|
||||||
fTempLines: TStringList;
|
fTempLines: TStringList;
|
||||||
//fPortNum: Word;
|
//fPortNum: Word;
|
||||||
|
fServerWasRunning: boolean;
|
||||||
fClient, fServer: TProcess;
|
fClient, fServer: TProcess;
|
||||||
fAvailable: boolean;
|
fAvailable: boolean;
|
||||||
fDoc: TCESynMemo;
|
fDoc: TCESynMemo;
|
||||||
|
|
@ -74,13 +75,19 @@ begin
|
||||||
fClient.ShowWindow := swoHIDE;
|
fClient.ShowWindow := swoHIDE;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
//
|
//
|
||||||
|
// TODO-ctest: test this feature on linux.
|
||||||
|
fServerWasRunning := AppIsRunning((serverName));
|
||||||
|
if not fServerWasRunning then begin
|
||||||
fServer := TProcess.Create(self);
|
fServer := TProcess.Create(self);
|
||||||
fServer.Executable := serverName;
|
fServer.Executable := serverName;
|
||||||
fServer.Options := [{$IFDEF WINDOWS} poNewConsole{$ENDIF}];
|
fServer.Options := [{$IFDEF WINDOWS} poNewConsole{$ENDIF}];
|
||||||
{$IFNDEF DEBUG}
|
{$IFNDEF DEBUG}
|
||||||
fServer.ShowWindow := swoHIDE;
|
fServer.ShowWindow := swoHIDE;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
end;
|
||||||
fTempLines := TStringList.Create;
|
fTempLines := TStringList.Create;
|
||||||
|
|
||||||
|
if (fServer <> nil) then
|
||||||
fServer.Execute;
|
fServer.Execute;
|
||||||
//
|
//
|
||||||
EntitiesConnector.addObserver(self);
|
EntitiesConnector.addObserver(self);
|
||||||
|
|
@ -91,8 +98,10 @@ begin
|
||||||
EntitiesConnector.removeObserver(self);
|
EntitiesConnector.removeObserver(self);
|
||||||
if fTempLines <> nil then
|
if fTempLines <> nil then
|
||||||
fTempLines.Free;
|
fTempLines.Free;
|
||||||
killServer;
|
if fServer <> nil then begin
|
||||||
|
if not fServerWasRunning then killServer;
|
||||||
fServer.Free;
|
fServer.Free;
|
||||||
|
end;
|
||||||
fClient.Free;
|
fClient.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue