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

This commit is contained in:
Michaël Van Canneyt 2024-02-04 10:47:37 +01:00
parent 8c8b336914
commit 299c90b91d

View File

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