Skip to content
Myr

Move exit codes to 'internal' module

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

authored by sharkdp · committed by sharkdp · parent 26ad7da · Browse files · 4 files+11 added−8 removed
This commit

State

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

Diff stats

4 files+11 added−8 removed

  • other:+11 added−8 removed

4 files+11 added−8 removed

modified:src/internal.rs+6 added
98 unmodified lines
99 Expr::Alternate(ref es) => es.iter().any(expr_has_uppercase_char),100 _ => false,101 }102}103104/// Exit code representing a general error105pub const EXITCODE_ERROR: i32 = 1;106107/// Exit code representing that the process was killed by SIGINT108pub const EXITCODE_SIGINT: i32 = 130;
modified:src/main.rs-1 removed
17 unmodified lines
18extern crate num_cpus;19extern crate regex;20extern crate regex_syntax;2122mod exit_codes;22pub mod fshelper;23pub mod lscolors;24mod app;25mod exec;
147 unmodified lines
modified:src/output.rs+3 added-4 removed
4 unmodified lines
5// at your option. All files in the project carrying such6// notice may not be copied, modified, or distributed except7// according to those terms.89use exit_codes;10use internal::FdOptions;9use internal::{FdOptions, EXITCODE_ERROR, EXITCODE_SIGINT};10use lscolors::LsColors;1112use std::{fs, process};13use std::io::{self, Write};
16 unmodified lines
30 };3132 if r.is_err() {33 // Probably a broken pipe. Exit gracefully.35 process::exit(exit_codes::ERROR);34 process::exit(EXITCODE_ERROR);35 }36}3738fn print_entry_colorized(
33 unmodified lines
72 };7374 if wants_to_quit.load(Ordering::Relaxed) {75 write!(handle, "\n")?;77 process::exit(exit_codes::SIGINT);76 process::exit(EXITCODE_SIGINT);77 }78 }7980 if config.null_separator {
51 unmodified lines
modified:src/walk.rs+2 added-3 removed
8 unmodified lines
9extern crate ctrlc;1011use exec;12use fshelper;13use internal::{error, FdOptions};13use internal::{error, FdOptions, EXITCODE_SIGINT};14use output;1516use exit_codes;16use std::process;17use std::path::PathBuf;18use std::sync::{Arc, Mutex};19use std::sync::atomic::{AtomicBool, Ordering};
227 unmodified lines
247 // Wait for the receiver thread to print out all results.248 receiver_thread.join().unwrap();249250 if wants_to_quit.load(Ordering::Relaxed) {252 process::exit(exit_codes::SIGINT);251 process::exit(EXITCODE_SIGINT);252 }253}