packages/fcl-process/src/unix/process.inc has the following function:
Function TProcess.Terminate(AExitCode : Integer) : Boolean;
begin
Result:=False;
Result:=fpkill(Handle,SIGTERM)=0;
If Result then
begin
If Running then
Result:=fpkill(Handle,SIGKILL)=0;
end;
{ the fact that the signal has been sent does not
mean that the process has already handled the
signal -> wait instead of calling getexitstatus }
if Result then
WaitOnExit;
end;
The initial
Result:=False; line has been removed.
After that, the code has been changed so that the condition to call
WaitOnExit is executed depending on
If Running then Result:=fpkill(Handle,SIGKILL)=0;The code becomes:
Function TProcess.Terminate(AExitCode : Integer) : Boolean;
begin
Result:=fpkill(Handle,SIGTERM)=0;
If Result then
begin
If Running then
begin
Result:=fpkill(Handle,SIGKILL)=0;
if not Result then exit;
end;
{ the fact that the signal has been sent does not
mean that the process has already handled the
signal -> wait instead of calling getexitstatus }
WaitOnExit;
end;
end;
Here is the patch
diff --git a/packages/fcl-process/src/unix/process.inc b/packages/fcl-process/src/unix/process.inc
index 54c00ef8ea..7099ca8339 100644
--- a/packages/fcl-process/src/unix/process.inc
+++ b/packages/fcl-process/src/unix/process.inc
@@ -530,18 +530,19 @@ procedure TProcess.CloseProcessHandles;
Function TProcess.Terminate(AExitCode : Integer) : Boolean;
begin
- Result:=False;
Result:=fpkill(Handle,SIGTERM)=0;
If Result then
begin
- If Running then
- Result:=fpkill(Handle,SIGKILL)=0;
+ If Running then
+ begin
+ Result:=fpkill(Handle,SIGKILL)=0;
+ if not Result then exit;
+ end;
+ { the fact that the signal has been sent does not
+ mean that the process has already handled the
+ signal -> wait instead of calling getexitstatus }
+ WaitOnExit;
end;
- { the fact that the signal has been sent does not
- mean that the process has already handled the
- signal -> wait instead of calling getexitstatus }
- if Result then
- WaitOnExit;
end;
Procedure TProcess.SetShowWindow (Value : TShowWindowOptions);