BufReader doesn't retrun error on EOF
@@ -843,20 +843,23 @@ 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();
loop {
buffer.clear();
- if reader.read_line(&mut buffer).is_err() {
+ match reader.read_line(&mut buffer) {
+ Ok(bytes) => {
+ if bytes == 0 {
return;
}
+ }
+ Err(_) => return,
+ }
if buffer.trim().is_empty() {
continue;
}
error!("[LSP::{}] {}", language_id, buffer.trim())
}
- }
});
}
