Browse Source

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 year ago
parent
commit
389c67a492
1 changed files with 5 additions and 7 deletions
  1. 5 7
      Projects/Src/CmnFunc2.pas

+ 5 - 7
Projects/Src/CmnFunc2.pas

@@ -1654,13 +1654,11 @@ begin
   var NulDevice := CreateFile('\\.\NUL', GENERIC_READ,
     FILE_SHARE_READ or FILE_SHARE_WRITE, @SecurityAttributes,
     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;
 
   PipeCreate(FStdOutPipeRead, FStdOutPipeWrite, SecurityAttributes);