Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore SendErrors when handling grammars #2641

Merged
merged 1 commit into from
Jun 2, 2022
Merged

Ignore SendErrors when handling grammars #2641

merged 1 commit into from
Jun 2, 2022

Conversation

Frojdholm
Copy link
Contributor

@Frojdholm Frojdholm commented Jun 1, 2022

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.

Solves #2642

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.
@the-mikedavis the-mikedavis linked an issue Jun 1, 2022 that may be closed by this pull request
@Frojdholm Frojdholm marked this pull request as ready for review June 1, 2022 20:02
@the-mikedavis
Copy link
Member

Before:

thread 'thread 'thread '<unnamed><unnamed>' panicked at '' panicked at 'thread 'called `Result::unwrap()` on an `Err` value: SendError { .. }called `Result::unwrap()` on an `Err` value: SendError { .. }', ', helix-loader/src/grammar.rshelix-loader/src/grammar.rs::136136::3535<unnamed>
' panicked at 'called `Result::unwrap()` on an `Err` value: SendError { .. }', helix-loader/src/grammar.rs
thread 'thread '<unnamed><unnamed><unnamed>' panicked at '' panicked at '' panicked at 'called `Result::unwrap()` on an `Err` value: SendError { .. }called `Result::unwrap()` on an `Err` value: SendError { .. }', ', helix-loader/src/grammar.rs::136:136called `Result::unwrap()` on an `Err` value: SendError { .. }35', 
helix-loader/src/grammar.rs:136:35
:thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: SendError { .. }', helix-loader/src/grammar.rs:35136
:35
helix-loader/src/grammar.rs:136:35
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: SendError { .. }', helix-loader/src/grammar.rs:136:35
stack backtrace:
Error: Failed to fetch some grammar(s)

Caused by:
    0: Could not create grammar directory "/home/michael/dev-tools/code/helix/rttest/grammars/sources/rust"
    1: Permission denied (os error 13)

After:

Error: Failed to fetch some grammar(s)

Caused by:
    0: Could not create grammar directory "/home/michael/dev-tools/code/helix/rttest/grammars/sources/rust"
    1: Permission denied (os error 13)

Nice, this really cleans it up 👍

@archseer archseer merged commit f7c27b6 into helix-editor:master Jun 2, 2022
@Frojdholm Frojdholm deleted the fix-grammars-crash branch June 2, 2022 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic when fetching grammars fail
3 participants