-
Notifications
You must be signed in to change notification settings - Fork 253
Description
tl;dr: 0 is ok, all other numbers are wrong. 1 and 0 aren't the only options. The original code was better.
only checks for errorlevel 1, but:
The maximum errorlevel that can be set is 2147483647. The minimum (negative) errorlevel that can be set is -2147483648 - https://ss64.com/nt/errorlevel.html
I don't think we can guarantee/limit the world of errorlevels to only 1 and 0 / and if even if so, if anything upstream makes a change, it'd be within their right which would break this too. Linker errors e.g. can be a different errorlevel. In this context, the prior, ugly, defensive check seemed more correct. Potentially, you can guarantee this, though. (I don't have anything with windows.)
This might be useful: https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-