Repository navigation
fix: exit the editor service instead of panicking when its output is closed - #1346
Merged
Merged
Conversation
…osed-output # Conflicts: # crates/dprint/src/commands/editor/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the editor closed the editor service's output (ex. the editor exits or drops the pipe before the service has stopped), the service panicked in two places: on the thread that writes the messages when the write failed, and then with "Receiver dropped" on the next response it tried to send.
Now a failed write stops the writer thread without panicking, and the service exits cleanly the next time it can't send a response, since there's nobody left to respond to.
The test covers sending a response with a closed output not panicking and flagging the output as closed. The message loop exiting on that flag isn't covered because the test environment's output pipe can't be made to fail.