From 77b7cb7d6171ba101a43957ec3d88d7eff7aa6b3 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 26 Dec 2020 12:25:57 +0000 Subject: [PATCH] startlazarus: darwin: fixed restart git-svn-id: branches/fixes_2_0@64280 - --- ide/lazarusmanager.pas | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ide/lazarusmanager.pas b/ide/lazarusmanager.pas index 919b232779..dfab8bf89c 100644 --- a/ide/lazarusmanager.pas +++ b/ide/lazarusmanager.pas @@ -397,19 +397,21 @@ begin if (EnvOverrides<>nil) and (EnvOverrides.Count>0) then AssignEnvironmentTo(FLazarusProcess.Process.Environment,EnvOverrides); {$IFDEF darwin} - // "open" process runs a bundle, but doesn't wait for it to finish execution - // "startlazarus" logic suggests that the Lazarus process would be waited - // and if the special 99 (ExitCodeRestartLazarus) code is received, - // would repeat the restart process. - // Since "open" doesn't play nice with "startlazarus" logic. - // The arguments would not indicate that lazarus was started by startlazarus + // GUI bundles must be opened by "open". + // "open" runs a bundle, but doesn't wait for it to finish execution. + // startlazarus will exit and lazarus has to start a new startlazarus + // when it needs a restart FLazarusProcess.Process.Executable:='/usr/bin/open'; Params.Add('-a'); Params.Add(FLazarusPath); Params.Add('--args'); + {$ELSE} + // tell lazarus, startlazarus is waiting for its exitcode + // When the special 99 (ExitCodeRestartLazarus) code is received, + // start a new lazars + Params.Add(StartedByStartLazarusOpt); {$ENDIF} Params.Add(NoSplashScreenOptLong); - Params.Add(StartedByStartLazarusOpt); for i:=0 to FCmdLineParams.Count-1 do AddExpandedParam(Params,FCmdLineParams[i]); FLazarusProcess.Process.Parameters.AddStrings(Params); @@ -422,8 +424,12 @@ begin FLazarusProcess.OnStart := @LazarusProcessStart; DebugLn(['Info: (startlazarus) [TLazarusManager.Run] exe',FLazarusProcess.Process.Executable,' Params=[',FLazarusProcess.Process.Parameters.Text,']']); FLazarusProcess.Execute; + {$IFDEF darwin} + Restart:=false; + {$ELSE} FLazarusProcess.WaitOnExit; Restart := FLazarusProcess.WantsRestart; + {$ENDIF} FreeAndNil(FLazarusProcess); end; until not Restart;