diff options
-rw-r--r-- | crates/ra_proc_macro_srv/src/cli.rs | 15 | ||||
-rw-r--r-- | crates/rust-analyzer/src/bin/main.rs | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/crates/ra_proc_macro_srv/src/cli.rs b/crates/ra_proc_macro_srv/src/cli.rs index c7f41e448..ded1bcdbc 100644 --- a/crates/ra_proc_macro_srv/src/cli.rs +++ b/crates/ra_proc_macro_srv/src/cli.rs | |||
@@ -4,16 +4,13 @@ use crate::{expand_task, list_macros}; | |||
4 | use ra_proc_macro::msg::{self, Message}; | 4 | use ra_proc_macro::msg::{self, Message}; |
5 | use std::io; | 5 | use std::io; |
6 | 6 | ||
7 | pub fn run() { | 7 | pub fn run() -> io::Result<()> { |
8 | loop { | 8 | loop { |
9 | let req = match read_request() { | 9 | // bubble up the error for read request, |
10 | Err(err) => { | 10 | // as the stdin pipe may be closed. |
11 | // Panic here, as the stdin pipe may be closed. | 11 | let req = match read_request()? { |
12 | // Otherwise, client will be restarted the service anyway. | 12 | None => continue, |
13 | panic!("Read message error on ra_proc_macro_srv: {}", err); | 13 | Some(req) => req, |
14 | } | ||
15 | Ok(None) => continue, | ||
16 | Ok(Some(req)) => req, | ||
17 | }; | 14 | }; |
18 | 15 | ||
19 | let res = match req { | 16 | let res = match req { |
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index e8d5dad65..22a84b50c 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs | |||
@@ -66,7 +66,7 @@ fn setup_logging() -> Result<()> { | |||
66 | } | 66 | } |
67 | 67 | ||
68 | fn run_proc_macro_srv() -> Result<()> { | 68 | fn run_proc_macro_srv() -> Result<()> { |
69 | ra_proc_macro_srv::cli::run(); | 69 | ra_proc_macro_srv::cli::run()?; |
70 | Ok(()) | 70 | Ok(()) |
71 | } | 71 | } |
72 | 72 | ||