On Thu Aug 31 16:41:05 2023 +0000, eric pouech wrote:
another comment: * it looks a bit ackward to add the global variable lastCmdSucceeded... as it's just errorlevel == 0 * couldn't this be doable by just testing the value of errorlevel from previous command in chaining? * maybe it'll require first to ensure that all commands properly set errorlevel The ERRORLEVEL check is not enough. There should be a separate variable to hold the status of the last command.
https://ss64.com/nt/errorlevel.html
Even though a CMD batch script should set or reset ERRORLEVEL after every command, there are a few exceptions:
Commands that do NOT affect the ERRORLEVEL: \ BREAK, ECHO, ENDLOCAL, FOR, IF, PAUSE, REM, RD/RMDIR, TITLE
Commands that will set but not clear an ERRORLEVEL: \ CLS, GOTO, KEYS, POPD, SHIFT
Commands that set an Exit Code but not the ERRORLEVEL: \ RD/RMDIR
Commands that set an ERRORLEVEL but not the Exit Code ([SO explanation](https://stackoverflow.com/questions/34936240/batch-goto-loses-errorlevel/349...)): \ MD/MKDIR
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3671#note_43975