mirror of https://github.com/lapce/lapce.git
BufReader doesn't retrun error on EOF
This commit is contained in:
parent
36c6c7d12f
commit
72db4dd382
|
@ -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())
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue