Pārlūkot izejas kodu

Don't log error when NUL device can't be opened

The help says there's no further output after an error, but that wasn't true in this case.
Jordan Russell 1 gadu atpakaļ
vecāks
revīzija
389c67a492
1 mainītis faili ar 5 papildinājumiem un 7 dzēšanām
  1. 5 7
      Projects/Src/CmnFunc2.pas

+ 5 - 7
Projects/Src/CmnFunc2.pas

@@ -1654,13 +1654,11 @@ begin
   var NulDevice := CreateFile('\\.\NUL', GENERIC_READ,
   var NulDevice := CreateFile('\\.\NUL', GENERIC_READ,
     FILE_SHARE_READ or FILE_SHARE_WRITE, @SecurityAttributes,
     FILE_SHARE_READ or FILE_SHARE_WRITE, @SecurityAttributes,
     OPEN_EXISTING, 0, 0);
     OPEN_EXISTING, 0, 0);
-  if NulDevice = INVALID_HANDLE_VALUE then
-    { In case the NUL device is missing (which it inexplicably seems to
-      be for some users, per web search), don't treat it as a fatal
-      error. Just leave FStdInNulDevice at 0. It's not ideal, but the
-      child process likely won't even attempt to access stdin anyway. }
-    LogErrorFmt('Failed to open NUL device (%d). Will pass NULL handle for stdin.', [GetLastError])
-  else
+  { In case the NUL device is missing (which it inexplicably seems to
+    be for some users, per web search), don't treat it as a fatal
+    error. Just leave FStdInNulDevice at 0. It's not ideal, but the
+    child process likely won't even attempt to access stdin anyway. }
+  if NulDevice <> INVALID_HANDLE_VALUE then
     FStdInNulDevice := NulDevice;
     FStdInNulDevice := NulDevice;
 
 
   PipeCreate(FStdOutPipeRead, FStdOutPipeWrite, SecurityAttributes);
   PipeCreate(FStdOutPipeRead, FStdOutPipeWrite, SecurityAttributes);