Expand description
§Exit Code Management
Provides standardized Unix exit codes following BSD sysexits.h
conventions.
§Exit Code Conventions
- 0: Success
- 1: General error
- 2: Misuse of shell command (reserved by Bash)
- 64-78: Specific error conditions (BSD sysexits.h)
- 126: Command cannot execute
- 127: Command not found
- 128+N: Fatal signal N (e.g., 130 = SIGINT)
§Usage
use adaptive_pipeline_bootstrap::exit_code::ExitCode;
fn run_application() -> Result<(), Box<dyn std::error::Error>> {
// Application logic here
Ok(())
}
fn main() {
let result = run_application();
let exit_code = match result {
Ok(_) => ExitCode::Success,
Err(e) => ExitCode::from_error(e.as_ref()),
};
std::process::exit(exit_code.as_i32());
}Enums§
- Exit
Code - Exit codes following Unix conventions (BSD sysexits.h)
Functions§
- map_
error_ to_ exit_ code - Maps application error messages to Unix exit codes (sysexits.h standard)
- result_
to_ exit_ code - Maps a Result to a process exit code