From 0f27485faf89064581aede41369d48faf872451a Mon Sep 17 00:00:00 2001 From: sharkdp Date: Fri, 20 Dec 2019 19:27:10 +0100 Subject: [PATCH] Quit immediately if the channel::send call failed --- src/walk.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/walk.rs b/src/walk.rs index df25666..4554a95 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -373,10 +373,12 @@ fn spawn_senders( } } - // TODO: take care of the unwrap call - tx_thread - .send(WorkerResult::Entry(entry_path.to_owned())) - .unwrap(); + let send_result = tx_thread + .send(WorkerResult::Entry(entry_path.to_owned())); + + if !send_result.is_ok() { + return ignore::WalkState::Quit; + } ignore::WalkState::Continue })