@@ -34,15 +34,25 @@ pub struct Client {
36impl Client {
36impl Client {
37− pub fn start(ex: &Executor, cmd: &str, args: &[String]) -> (Self, Receiver<Call>) {
37+ pub fn start(ex: &Executor, cmd: &str, args: &[String]) -> Result<(Self, Receiver<Call>)> {
38+ // smol makes sure the process is reaped on drop, but using kill_on_drop(true) maybe?
38− let mut process = Command::new(cmd)
39+ let process = Command::new(cmd)
39 .args(args)
40 .args(args)
40 .stdin(Stdio::piped())
41 .stdin(Stdio::piped())
41 .stdout(Stdio::piped())
42 .stdout(Stdio::piped())
42 .stderr(Stdio::piped())
43 .stderr(Stdio::piped())
43− .spawn()
44+ .spawn();
44− .expect("Failed to start language server");
45+
45− // smol makes sure the process is reaped on drop, but using kill_on_drop(true) maybe?
46+ // use std::io::ErrorKind;
47+ let mut process = match process {
48+ Ok(process) => process,
49+ Err(err) => match err.kind() {
50+ // ErrorKind::NotFound | ErrorKind::PermissionDenied => {
51+ // return Err(Error::Other(err.into()))
53+ _kind => return Err(Error::Other(err.into())),
47 // TODO: do we need bufreader/writer here? or do we use async wrappers on unblock?
57 // TODO: do we need bufreader/writer here? or do we use async wrappers on unblock?
48 let writer = BufWriter::new(process.stdin.take().expect("Failed to open stdin"));
58 let writer = BufWriter::new(process.stdin.take().expect("Failed to open stdin"));
@@ -65,7 +75,7 @@ impl Client {
65 // TODO: async client.initialize()
75 // TODO: async client.initialize()
66 // maybe use an arc<atomic> flag
76 // maybe use an arc<atomic> flag
68− (client, incoming)
78+ Ok((client, incoming))
71 fn next_request_id(&self) -> jsonrpc::Id {
81 fn next_request_id(&self) -> jsonrpc::Id {