You are not logged in.
Pages: 1
Hello,
A need to start a secondary console application inside the daemon, and not wait for execution.
When using RunProcess (or RunCommand) inside a daemon, the target application does not start and generates the error "File not open".
- Both Daemon App and Target dont uses Writeln.
- When running the very same Daemon as console (./mydaemon --console), works fine.
- When using Free Pascal native process.RunCommandIndir method works inside the Daemon, but dont have the option to "not wait".
procedure TDaemon.Start;
try
mormot.core.os.RunProcess('/home/ubuntu/app/targetapp', 'myParam', false);
except
on E : Exception do
FileFromString('Error: ' + E.Message, 'error.txt'); //Write: File not open
end;
Offline
Solved with TProcess from FP.
Process := TProcess.Create(nil);
...
Process.InheritHandles := False;
Process.Options := [];
Process.ShowWindow := swoNone;
Process.Executable := '/home/ubuntu/app/targetapp';
Process.Parameters.Add('myParam');
Process.Execute;
Secondary app run detached.
Offline
Pages: 1