[CMD] Addendum to 26ff2c8 and to r40474 / 8cf1106: Fix CMD process exit code.

As it appears, the process exit code of CMD /C is really the errorlevel,
and not the "command's return value".
This commit is contained in:
Hermès Bélusca-Maïto 2017-11-19 00:45:33 +01:00
parent 26ff2c8ef3
commit 7bd33ac4df
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

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