Преглед на файлове

Invalidate Handle, even if we don't close it. (it may be set, e.g. for iotNone)

Martin преди 1 година
родител
ревизия
2e9ceda11b
променени са 1 файла, в които са добавени 5 реда и са изтрити 2 реда
  1. 5 2
      packages/fcl-process/src/processbody.inc

+ 5 - 2
packages/fcl-process/src/processbody.inc

@@ -1078,10 +1078,13 @@ var
   H : THandle;
 
 begin
-  if (FTheirHandleIOType=iotNone) or Not FHandleValid then
+  if Not FHandleValid then
      exit;
-  If not (CloseHandleOnExecute or aForceClose) then
+  If (FTheirHandleIOType=iotNone) or not (CloseHandleOnExecute or aForceClose) then
+    begin
+    FTheirHandle:=THandle(INVALID_HANDLE_VALUE);
      exit;
+    end;
   H:=ResolveProcessHandle;
   // Writeln(StdErr,GetProcessID,' : ',ProcessHandleType,' closing their handle ',IOType,': ',H);
   FTheirHandle:=THandle(INVALID_HANDLE_VALUE);