|
/// Prints the error and exits. |
|
/// |
|
/// Depending on the error kind, this either prints to `stderr` and exits with a status of `1` |
|
/// or prints to `stdout` and exits with a status of `0`. |
|
pub fn exit(&self) -> ! { |
|
if self.use_stderr() { |
|
// Swallow broken pipe errors |
|
let _ = self.print(); |
|
|
|
if self.wait_on_exit { |
|
wlnerr!("\nPress [ENTER] / [RETURN] to continue..."); |
|
let mut s = String::new(); |
|
let i = io::stdin(); |
|
i.lock().read_line(&mut s).unwrap(); |
|
} |
|
|
|
safe_exit(USAGE_CODE); |
|
} |
|
|
|
// Swallow broken pipe errors |
|
let _ = self.print(); |
|
safe_exit(SUCCESS_CODE) |
|
} |
As per #1327, the USAGE_EXIT code is now 2, but the documentation still states that it exits with code 1.
clap/src/parse/errors.rs
Lines 478 to 500 in d52b326
As per #1327, the
USAGE_EXITcode is now 2, but the documentation still states that it exits with code 1.