Skip to content

Suggestion: Add ExitCodeExt for Windows #97914

Closed
@AronParker

Description

@AronParker

I welcome the newly stabilized ExitCode which allows Termination with an exit code.

I am facing some difficulties using it on Windows however, most programs on Windows if they use the exit code at all return an HRESULT or DWORD, neither of which are constructible from the current only available impl From<u8> for ExitCode. Right now I resort to using pointers to access the internals of ExitCode on Windows, which is undesirable. I suggest adding the following windows-specific trait:

impl From<i32> for ExitCode {
    fn from(code: i32) -> Self { ... }
}

Alternatively, a trait named ExitCodeExt could also be added for Windows which allows generation of i32 based error codes.

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