From ede2a24a9f2918cf60834c7e162a4d89acbe6216 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 28 Dec 2022 13:11:13 -0500 Subject: [PATCH] Try harder to fix #916 The underlying Rust issue[1] was recently re-introduced and re-fixed. Rather than wait for a new Rust release, apply effectively the same fix as a workaround in the ignore crate itself. [1]: https://github.com/rust-lang/rust/issues/50619 --- crates/ignore/src/walk.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/ignore/src/walk.rs b/crates/ignore/src/walk.rs index 8625b5f9b..f750554e5 100644 --- a/crates/ignore/src/walk.rs +++ b/crates/ignore/src/walk.rs @@ -1495,6 +1495,7 @@ impl<'s> Worker<'s> { return WalkState::Skip; } for result in readdir { + let is_err = result.is_err(); let state = self.generate_work( &work.ignore, depth + 1, @@ -1504,6 +1505,12 @@ impl<'s> Worker<'s> { if state.is_quit() { return state; } + // Break after we see an error. + // See https://github.com/rust-lang/rust/issues/50619 + // and https://github.com/BurntSushi/ripgrep/issues/916 + if is_err { + break; + } } WalkState::Continue }