diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2024-09-06 09:13:00 +0200 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2024-09-06 09:13:00 +0200 |
| commit | 775c5c84a5ce996520f9cad9dab1981fb8532d64 (patch) | |
| tree | c0991b9d179ee34595704e753a9939c08609b354 /src/tools/rust-analyzer/lib/lsp-server | |
| parent | 7e5a0e5777715dfc5a4ffafeb643c04cc438d4be (diff) | |
| download | rust-775c5c84a5ce996520f9cad9dab1981fb8532d64.tar.gz rust-775c5c84a5ce996520f9cad9dab1981fb8532d64.zip | |
fix: Don't panic lsp writer thread on dropped receiver
Diffstat (limited to 'src/tools/rust-analyzer/lib/lsp-server')
| -rw-r--r-- | src/tools/rust-analyzer/lib/lsp-server/Cargo.toml | 2 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/lib/lsp-server/src/stdio.rs | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/tools/rust-analyzer/lib/lsp-server/Cargo.toml b/src/tools/rust-analyzer/lib/lsp-server/Cargo.toml index fb3411c8ab4..cce007ae54c 100644 --- a/src/tools/rust-analyzer/lib/lsp-server/Cargo.toml +++ b/src/tools/rust-analyzer/lib/lsp-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lsp-server" -version = "0.7.6" +version = "0.7.7" description = "Generic LSP server scaffold." license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/rust-analyzer/tree/master/lib/lsp-server" diff --git a/src/tools/rust-analyzer/lib/lsp-server/src/stdio.rs b/src/tools/rust-analyzer/lib/lsp-server/src/stdio.rs index c28545fb574..279a6bce080 100644 --- a/src/tools/rust-analyzer/lib/lsp-server/src/stdio.rs +++ b/src/tools/rust-analyzer/lib/lsp-server/src/stdio.rs @@ -30,7 +30,9 @@ pub(crate) fn stdio_transport() -> (Sender<Message>, Receiver<Message>, IoThread let is_exit = matches!(&msg, Message::Notification(n) if n.is_exit()); debug!("sending message {:#?}", msg); - reader_sender.send(msg).expect("receiver was dropped, failed to send a message"); + if let Err(e) = reader_sender.send(msg) { + return Err(io::Error::new(io::ErrorKind::Other, e)); + } if is_exit { break; @@ -60,15 +62,11 @@ impl IoThreads { pub fn join(self) -> io::Result<()> { match self.reader.join() { Ok(r) => r?, - Err(err) => { - println!("reader panicked!"); - std::panic::panic_any(err) - } + Err(err) => std::panic::panic_any(err), } match self.writer.join() { Ok(r) => r, Err(err) => { - println!("writer panicked!"); std::panic::panic_any(err); } } |
