#sysexit #cli #exit-code

no-std exit-code

Commonly used exit codes for usage in applications

1 stable release

Uses old Rust 2015

1.0.0 Jun 4, 2017

#554 in Command-line interface

Download history 167/week @ 2023-12-18 67/week @ 2023-12-25 34/week @ 2024-01-01 51/week @ 2024-01-08 53/week @ 2024-01-15 31/week @ 2024-01-22 23/week @ 2024-01-29 24/week @ 2024-02-05 55/week @ 2024-02-12 47/week @ 2024-02-19 69/week @ 2024-02-26 70/week @ 2024-03-04 46/week @ 2024-03-11 51/week @ 2024-03-18 56/week @ 2024-03-25 91/week @ 2024-04-01

259 downloads per month
Used in 3 crates



Rust Exit Codes

Commonly used exit codes for usage in applications.

Using appropriate exit codes greatly helps users of applications to assert them in their own scripts and take appropriate actions based on the returned code. Simply using the catchall exit code 1 all the time does not help others in any way. Unless there is only a single source of error in the complete application, which is very unlikely.


Add the following to your Cargo.toml file:

exit_codes = "1.0.0"


extern crate exit_code;

fn main() {
    use std::process::exit;
    use exit_code::SUCCESS;

    println!("Hello, World!");

This crate provides two additional functions that allow validation of exit codes:

  • is_reserved(exit_code) -> bool can be used to check if a given exit code has a reserved meaning in a shell, refer to the API documentation for the meaning of the reserved exit codes.
  • is_valid(exit_code) -> bool can be used to check if a given exit code is within the range [0..256] (anything below or beyond silently overflows).


No runtime deps