From 39fb41f05a2398f098644e1cc45aa57d7d73d2e7 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Wed, 3 Jan 2018 10:00:22 +0100 Subject: [PATCH] Move exit codes to 'internal' module --- src/internal.rs | 6 ++++++ src/main.rs | 1 - src/output.rs | 7 +++---- src/walk.rs | 5 ++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/internal.rs b/src/internal.rs index 206c381..88fd1c7 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -100,3 +100,9 @@ fn expr_has_uppercase_char(expr: &Expr) -> bool { _ => false, } } + +/// Exit code representing a general error +pub const EXITCODE_ERROR: i32 = 1; + +/// Exit code representing that the process was killed by SIGINT +pub const EXITCODE_SIGINT: i32 = 130; diff --git a/src/main.rs b/src/main.rs index ac2f23e..36900c7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,6 @@ extern crate num_cpus; extern crate regex; extern crate regex_syntax; -mod exit_codes; pub mod fshelper; pub mod lscolors; mod app; diff --git a/src/output.rs b/src/output.rs index 7ba8fb0..cc3fb46 100644 --- a/src/output.rs +++ b/src/output.rs @@ -6,8 +6,7 @@ // notice may not be copied, modified, or distributed except // according to those terms. -use exit_codes; -use internal::FdOptions; +use internal::{FdOptions, EXITCODE_ERROR, EXITCODE_SIGINT}; use lscolors::LsColors; use std::{fs, process}; @@ -32,7 +31,7 @@ pub fn print_entry(entry: &PathBuf, config: &FdOptions, wants_to_quit: &Arc, config: Arc) { receiver_thread.join().unwrap(); if wants_to_quit.load(Ordering::Relaxed) { - process::exit(exit_codes::SIGINT); + process::exit(EXITCODE_SIGINT); } }