From 87179dd3faaaf4a308983a3fdb8a1f5cb2fdd433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hampus=20Fr=C3=B6jdholm?= Date: Wed, 1 Jun 2022 19:30:12 +0200 Subject: [PATCH] Ignore SendErrors when handling grammars 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. --- helix-loader/src/grammar.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index d2769d81f6b4..7aa9bc8346e1 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -133,7 +133,9 @@ where let tx = tx.clone(); pool.execute(move || { - tx.send(job(grammar)).unwrap(); + // Ignore any SendErrors, if any job in another thread has encountered an + // error the Receiver will be closed causing this send to fail. + let _ = tx.send(job(grammar)); }); }