瀏覽代碼

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;
   H : THandle;
 
 
 begin
 begin
-  if (FTheirHandleIOType=iotNone) or Not FHandleValid then
+  if Not FHandleValid then
      exit;
      exit;
-  If not (CloseHandleOnExecute or aForceClose) then
+  If (FTheirHandleIOType=iotNone) or not (CloseHandleOnExecute or aForceClose) then
+    begin
+    FTheirHandle:=THandle(INVALID_HANDLE_VALUE);
      exit;
      exit;
+    end;
   H:=ResolveProcessHandle;
   H:=ResolveProcessHandle;
   // Writeln(StdErr,GetProcessID,' : ',ProcessHandleType,' closing their handle ',IOType,': ',H);
   // Writeln(StdErr,GetProcessID,' : ',ProcessHandleType,' closing their handle ',IOType,': ',H);
   FTheirHandle:=THandle(INVALID_HANDLE_VALUE);
   FTheirHandle:=THandle(INVALID_HANDLE_VALUE);