Skip to content
Myr

Exit immediately when Ctrl-C has been pressed twice

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

authored by sharkdp · committed by sharkdp · parent 3599a30 · Browse files · 1 file+6 added−1 removed
This commit

State

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

Diff stats

1 file+6 added−1 removed

  • other:+6 added−1 removed

1 file+6 added−1 removed

modified:src/walk.rs+6 added-1 removed
108 unmodified lines
109 let wants_to_quit = Arc::new(AtomicBool::new(false));110 if config.ls_colors.is_some() && config.command.is_none() {111 let wq = Arc::clone(&wants_to_quit);112 ctrlc::set_handler(move || {113 if wq.load(Ordering::Relaxed) {114 // Ctrl-C has been pressed twice, exit NOW115 process::exit(ExitCode::KilledBySigint.into());116 } else {113 wq.store(true, Ordering::Relaxed);117 wq.store(true, Ordering::Relaxed);118 }119 })120 .unwrap();121 }122
264 unmodified lines