Bubble up error

This commit is contained in:
Edwin Cheng 2020-04-24 01:38:58 +08:00
parent 25e8f5ded9
commit 1627b55028
2 changed files with 7 additions and 10 deletions

View file

@ -4,16 +4,13 @@ use crate::{expand_task, list_macros};
use ra_proc_macro::msg::{self, Message}; use ra_proc_macro::msg::{self, Message};
use std::io; use std::io;
pub fn run() { pub fn run() -> io::Result<()> {
loop { loop {
let req = match read_request() { // bubble up the error for read request,
Err(err) => { // as the stdin pipe may be closed.
// Panic here, as the stdin pipe may be closed. let req = match read_request()? {
// Otherwise, client will be restarted the service anyway. None => continue,
panic!("Read message error on ra_proc_macro_srv: {}", err); Some(req) => req,
}
Ok(None) => continue,
Ok(Some(req)) => req,
}; };
let res = match req { let res = match req {

View file

@ -66,7 +66,7 @@ fn setup_logging() -> Result<()> {
} }
fn run_proc_macro_srv() -> Result<()> { fn run_proc_macro_srv() -> Result<()> {
ra_proc_macro_srv::cli::run(); ra_proc_macro_srv::cli::run()?;
Ok(()) Ok(())
} }