chipsenkbeil/distant

Wrong exit code for `distant --version` and `distant --help`

chipsenkbeil opened this issue · 2 comments

Both of these should ideally return exit code 0, but they are returning 1 because we are capturing any error and using 1.

let args = match Self::try_parse_from(args) {
    Ok(args) => args,
    Err(e) if e.use_stderr() => {
        let _ = e.print();
        return /* exit code 1 */;
    }
    Err(e) => {
        let _ = e.print();
        return /* exit code 0 */;
    }
};

See this example: https://github.com/crate-ci/typos/blob/master/crates/typos-cli/src/bin/typos-cli/main.rs

Resolved by e0b8769.

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.