mirror of
https://github.com/sharkdp/fd
synced 2024-09-15 22:20:45 +00:00
ErrorCode enum variants to be more descriptive
This commit is contained in:
parent
8bdd8f8e8f
commit
cb1cfa108b
|
@ -1,13 +1,13 @@
|
|||
pub enum ExitCode {
|
||||
Error,
|
||||
Sigint,
|
||||
GeneralError,
|
||||
KilledBySigint,
|
||||
}
|
||||
|
||||
impl Into<i32> for ExitCode {
|
||||
fn into(self) -> i32 {
|
||||
match self {
|
||||
ExitCode::Error => 1,
|
||||
ExitCode::Sigint => 130,
|
||||
ExitCode::GeneralError => 1,
|
||||
ExitCode::KilledBySigint => 130,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ pub fn print_entry(entry: &PathBuf, config: &FdOptions, wants_to_quit: &Arc<Atom
|
|||
|
||||
if r.is_err() {
|
||||
// Probably a broken pipe. Exit gracefully.
|
||||
process::exit(ExitCode::Error.into());
|
||||
process::exit(ExitCode::GeneralError.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ fn print_entry_colorized(
|
|||
|
||||
if wants_to_quit.load(Ordering::Relaxed) {
|
||||
write!(handle, "\n")?;
|
||||
process::exit(ExitCode::Sigint.into());
|
||||
process::exit(ExitCode::KilledBySigint.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -319,6 +319,6 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
|
|||
receiver_thread.join().unwrap();
|
||||
|
||||
if wants_to_quit.load(Ordering::Relaxed) {
|
||||
process::exit(ExitCode::Sigint.into());
|
||||
process::exit(ExitCode::KilledBySigint.into());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue