Skip to main content

exit_code_from_status

Function exit_code_from_status 

Source
pub fn exit_code_from_status(status: ExitStatus) -> i32
Expand description

Translate child ExitStatus to a parent exit code.

On Unix a signal-killed child has None from .code(). Old code collapsed that to 1. That loses signal identity: SIGKILL (OOM killer, exit 137), SIGSEGV (139), Ctrl-C (130) all look like plain exit 1. CI pipelines watching for 137 to detect OOM cannot distinguish it from a normal script error anymore. Bash convention is 128 + signum, match that.

Windows has no signal concept so .code() is always Some, the fallback 1 is dead code there but keeps the function total.