diff --git a/src/output.rs b/src/output.rs index 471b8fb9d..da298c0c2 100644 --- a/src/output.rs +++ b/src/output.rs @@ -1,8 +1,6 @@ use std::io::{self, StdoutLock, Write}; use std::path::Path; use std::process; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::Arc; use lscolors::{LsColors, Style}; @@ -20,7 +18,6 @@ pub fn print_entry( stdout: &mut StdoutLock, entry: &Path, config: &Options, - wants_to_quit: &Arc, ) { let path = if entry.is_absolute() { entry @@ -29,7 +26,7 @@ pub fn print_entry( }; let r = if let Some(ref ls_colors) = config.ls_colors { - print_entry_colorized(stdout, path, config, ls_colors, wants_to_quit) + print_entry_colorized(stdout, path, config, ls_colors) } else { print_entry_uncolorized(stdout, path, config) }; @@ -51,7 +48,6 @@ fn print_entry_colorized( path: &Path, config: &Options, ls_colors: &LsColors, - wants_to_quit: &Arc, ) -> io::Result<()> { let default_style = ansi_term::Style::default(); @@ -66,12 +62,6 @@ fn print_entry_colorized( *path_string.to_mut() = replace_path_separator(&path_string, separator); } write!(stdout, "{}", style.paint(path_string))?; - - // TODO: can we move this out of the if-statement? Why do we call it that often? - if wants_to_quit.load(Ordering::Relaxed) { - writeln!(stdout)?; - process::exit(ExitCode::KilledBySigint.into()); - } } if config.null_separator { diff --git a/src/walk.rs b/src/walk.rs index 0d91b91aa..1dd813502 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -145,7 +145,7 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc, config: Arc) -> } // Spawn the thread that receives all results through the channel. - let receiver_thread = spawn_receiver(&config, &wants_to_quit, rx); + let receiver_thread = spawn_receiver(&config, rx); // Spawn the sender threads. spawn_senders(&config, &wants_to_quit, pattern, parallel_walker, tx); @@ -162,11 +162,9 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc, config: Arc) -> fn spawn_receiver( config: &Arc, - wants_to_quit: &Arc, rx: Receiver, ) -> thread::JoinHandle { let config = Arc::clone(config); - let wants_to_quit = Arc::clone(wants_to_quit); let show_filesystem_errors = config.show_filesystem_errors; let threads = config.threads; @@ -251,7 +249,6 @@ fn spawn_receiver( &mut stdout, v, &config, - &wants_to_quit, ); } buffer.clear(); @@ -261,7 +258,7 @@ fn spawn_receiver( } } ReceiverMode::Streaming => { - output::print_entry(&mut stdout, &value, &config, &wants_to_quit); + output::print_entry(&mut stdout, &value, &config); } } @@ -286,7 +283,7 @@ fn spawn_receiver( if !buffer.is_empty() { buffer.sort(); for value in buffer { - output::print_entry(&mut stdout, &value, &config, &wants_to_quit); + output::print_entry(&mut stdout, &value, &config); } }