Browse Source

* Patch from Martin to set FCloseHandleOnExecute before invoking OnGetHandle - the handler might change it

Michaël Van Canneyt 1 year ago
parent
commit
299c90b91d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/fcl-process/src/processbody.inc

+ 1 - 1
packages/fcl-process/src/processbody.inc

@@ -1180,6 +1180,7 @@ begin
     begin
     begin
     FTheirHandleIOType := IOType;
     FTheirHandleIOType := IOType;
     FOurHandle:=THAndle(INVALID_HANDLE_VALUE);
     FOurHandle:=THAndle(INVALID_HANDLE_VALUE);
+    FCloseHandleOnExecute:=(IOType<>iotDefault);
     Case IOType of
     Case IOType of
       iotDefault : H:=CreateStandardHandle;
       iotDefault : H:=CreateStandardHandle;
       iotPipe : H:=CreatePipeHandle;
       iotPipe : H:=CreatePipeHandle;
@@ -1188,7 +1189,6 @@ begin
       iotHandle : H:=CreateCustomHandle;
       iotHandle : H:=CreateCustomHandle;
       iotNull : H:=CreateNullFileHandle;
       iotNull : H:=CreateNullFileHandle;
     end;
     end;
-    FCloseHandleOnExecute:=(IOType<>iotDefault);
     FTheirHandle:=PrepareCreatedHandleForProcess(H);
     FTheirHandle:=PrepareCreatedHandleForProcess(H);
     if Assigned(FAfterAllocateHandle) then
     if Assigned(FAfterAllocateHandle) then
       FAfterAllocateHandle(Self,FTheirHandle,FCloseHandleOnExecute);
       FAfterAllocateHandle(Self,FTheirHandle,FCloseHandleOnExecute);