diff --git a/lapce-proxy/src/lsp.rs b/lapce-proxy/src/lsp.rs index 3c8aed5b..7f909ead 100644 --- a/lapce-proxy/src/lsp.rs +++ b/lapce-proxy/src/lsp.rs @@ -843,19 +843,22 @@ fn handle_stdout(&self, stdout: ChildStdout) { fn handle_stderr(&self, stderr: ChildStderr, language_id: String) { thread::spawn(move || { let mut reader = Box::new(BufReader::new(stderr)); - loop { - let mut buffer = String::new(); + let mut buffer = String::new(); - loop { - buffer.clear(); - if reader.read_line(&mut buffer).is_err() { - return; + loop { + buffer.clear(); + match reader.read_line(&mut buffer) { + Ok(bytes) => { + if bytes == 0 { + return; + } } - if buffer.trim().is_empty() { - continue; - } - error!("[LSP::{}] {}", language_id, buffer.trim()) + Err(_) => return, } + if buffer.trim().is_empty() { + continue; + } + error!("[LSP::{}] {}", language_id, buffer.trim()) } }); }