mirror of
https://github.com/reactos/reactos.git
synced 2026-06-03 01:41:13 +08:00
[CMD] Fix the errorlevel value set by the EXIT command, and when a batch file has run.
CORE-10495 CORE-13672 - Fix the behaviour of the EXIT command, where it set the last errorlevel value ONLY when it was called with the /b switch and otherwise kept the ambient one, instead of always using the value that the user specified on the command-line. - When a batch file has terminated, make the Batch() helper returning the errorlevel value so that, when the batch file has been started with the CALL command, CALL can in turn set the correct errorlevel value. Verified with respect to Windows' cmd.exe.
This commit is contained in:
@@ -299,7 +299,8 @@ INT Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd)
|
||||
* return until this context has been exited */
|
||||
new.prev = bc;
|
||||
/* copy some fields in the new structure if it is the same file */
|
||||
if (same_fn) {
|
||||
if (same_fn)
|
||||
{
|
||||
new.mem = bc->mem;
|
||||
new.memsize = bc->memsize;
|
||||
new.mempos = 0;
|
||||
@@ -366,6 +367,9 @@ INT Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd)
|
||||
FreeCommand(Cmd);
|
||||
}
|
||||
|
||||
/* Always return the current errorlevel */
|
||||
ret = nErrorLevel;
|
||||
|
||||
TRACE ("Batch: returns TRUE\n");
|
||||
|
||||
fc = saved_fc;
|
||||
|
||||
Reference in New Issue
Block a user