Skip to content

Windows has Errorlevels besides 1 #1631

@veqqq

Description

@veqqq

tl;dr: 0 is ok, all other numbers are wrong. 1 and 0 aren't the only options. The original code was better.

332f123

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-

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions