on master help sign in
Ignore SendErrors when handling grammars (#2641)

When handling grammars, fetching and building is done in a thread pool. Results are communicated over channels and the receiving channel is closed on first error. This causes subsequent sends to fail causing a mess in stderr. This ignores all SendErrors causing only the first error to be printed.

commitf7c27b604f32cbd10ec42f70d3fec3ff79cacc63 authorFrojdholm <Frojdholm@users.noreply.github.com> dateThu 2 Jun 2022, 09:54 (4 years ago) parent378f438
1 file changed+3−1
helix-loader/src/grammar.rs+3−1
helix-loader/src/grammar.rs+3−1
@@ -133,7 +133,9 @@ where
133133 let tx = tx.clone();
134134
135135 pool.execute(move || {
136− tx.send(job(grammar)).unwrap();
136+ // Ignore any SendErrors, if any job in another thread has encountered an
137+ // error the Receiver will be closed causing this send to fail.
138+ let _ = tx.send(job(grammar));
137139 });
138140 }
139141