[CMD] Addendum to 26ff2c8 and to r40474 / 8cf1106: Fix CMD process exit code.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 18 Nov 2017 23:45:33 +0000 (00:45 +0100)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 18 Nov 2017 23:48:37 +0000 (00:48 +0100)
As it appears, the process exit code of CMD /C is really the errorlevel,
and not the "command's return value".

base/shell/cmd/cmd.c

index 549f10d..d9a03a2 100644 (file)
@@ -1800,7 +1800,7 @@ Initialize(VOID)
     HMODULE NtDllModule;
     TCHAR commandline[CMDLINE_LENGTH];
     TCHAR ModuleName[_MAX_PATH + 1];
-    INT nExitCode;
+    // INT nExitCode;
 
     HANDLE hIn, hOut;
 
@@ -1985,11 +1985,11 @@ Initialize(VOID)
         /* Do the /C or /K command */
         GetCmdLineCommand(commandline, &ptr[2], AlwaysStrip);
         bWaitForCommand = TRUE;
-        nExitCode = ParseCommandLine(commandline);
+        /* nExitCode = */ ParseCommandLine(commandline);
         bWaitForCommand = FALSE;
         if (option != _T('K'))
         {
-            nErrorLevel = nExitCode;
+            // nErrorLevel = nExitCode;
             bExit = TRUE;
         }
     }