Hello All,
I am starting a process using TProcess in raspberry pi. This is done in a loop. The loop runs successfully for half a day and then stops with an error 'Failed to fork a process'.
This is the code that I am using:
command:='sudo /sbin/ip link set __INTERFACE__ up type can bitrate __BAUDRATE__';
command := StringReplace(command,'__INTERFACE__',interfacename,[]);
command := StringReplace(command,'__BAUDRATE__',baudrate,[]);
AProcess := TProcess.Create(nil);
AProcess.Options := AProcess.Options + [poWaitOnExit,poUsePipes];
AProcess.CommandLine:=command;
Aprocess.Execute;
if AProcess.ExitStatus=0 then
Result:=0
else
Result:=-1;
AProcess.Free;
I have tried adding AProcess.WaitForExit after Aprocess.Execute line and also tried manually killing the Aprocess using the function fpKill(AProcess.ProcessID,SIGKILL) or also used this function fpKill(AProcess.ProcessID,SIGINT).
I have also tried removing poUsePipes option.
None of them is working out and the same error occurs again and again.
Please help me in finding a solution for this problem.
Thanks!
Regards,
Gayathri