[CMD] Additional fixes for ERRORLEVEL and last returned exit code from EXIT, CALL...
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 29 Jul 2020 23:44:43 +0000 (01:44 +0200)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 19 Aug 2020 18:36:03 +0000 (20:36 +0200)
commitd78e8029b8b499d00776c54dd30a95b0afbd285a
treeb548fa05049ff0a2eadd4c26bd6504edf05c8489
parent4c9d322c688054b74760cde38fc431589a6408f4
[CMD] Additional fixes for ERRORLEVEL and last returned exit code from EXIT, CALL commands and CMD.
CORE-10495 CORE-13672

- Fix how the ERRORLEVEL and the last returned exit code are set by
  EXIT and CALL commands, when batch contexts terminate, and when CMD
  runs in single-command mode (with /C).

  Addendum to commit 26ff2c8e, and reverts commit 7bd33ac4.
  See also commit 8cf11060 (r40474).

  More information can be found at:
  https://ss64.com/nt/exit.html
  https://stackoverflow.com/a/34987886/13530036
  https://stackoverflow.com/a/34937706/13530036

- Move the actual execution of the CMD command-line (in /C or /K
  single-command mode) from Initialize() to _tmain(), to put it on par
  with the ProcessInput() interactive mode.

- Make ProcessInput() also return the last command's exit code.
base/shell/cmd/batch.c
base/shell/cmd/call.c
base/shell/cmd/cmd.c
base/shell/cmd/internal.c