Skip to content
Myr

ErrorCode enum variants to be more descriptive

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Josh Leeb-du Toit · committed by David Peter · parent 8bdd8f8 · Browse files · 3 files+7 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+7 added−7 removed

  • other:+7 added−7 removed

3 files+7 added−7 removed

modified:src/exit_codes.rs+4 added-4 removed
1pub enum ExitCode {2 Error,3 Sigint,2 GeneralError,3 KilledBySigint,4}56impl Into<i32> for ExitCode {7 fn into(self) -> i32 {8 match self {9 ExitCode::Error => 1,10 ExitCode::Sigint => 130,9 ExitCode::GeneralError => 1,10 ExitCode::KilledBySigint => 130,11 }12 }13}
modified:src/output.rs+2 added-2 removed
43 unmodified lines
44 };4546 if r.is_err() {47 // Probably a broken pipe. Exit gracefully.48 process::exit(ExitCode::Error.into());48 process::exit(ExitCode::GeneralError.into());49 }50}5152fn print_entry_colorized(
33 unmodified lines
86 };8788 if wants_to_quit.load(Ordering::Relaxed) {89 write!(handle, "\n")?;90 process::exit(ExitCode::Sigint.into());90 process::exit(ExitCode::KilledBySigint.into());91 }92 }9394 if config.null_separator {
44 unmodified lines
modified:src/walk.rs+1 added-1 removed
317 unmodified lines
318 // Wait for the receiver thread to print out all results.319 receiver_thread.join().unwrap();320321 if wants_to_quit.load(Ordering::Relaxed) {322 process::exit(ExitCode::Sigint.into());322 process::exit(ExitCode::KilledBySigint.into());323 }324}