@@ -34,15 +34,25 @@ pub struct Client {
3434}
3535
3636impl Client {
37− pub fn start(ex: &Executor, cmd: &str, args: &[String]) -> (Self, Receiver<Call>) {
38− let mut process = Command::new(cmd)
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?
39+ let process = Command::new(cmd)
3940 .args(args)
4041 .stdin(Stdio::piped())
4142 .stdout(Stdio::piped())
4243 .stderr(Stdio::piped())
43− .spawn()
44− .expect("Failed to start language server");
45− // smol makes sure the process is reaped on drop, but using kill_on_drop(true) maybe?
44+ .spawn();
45+
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()))
52+ // }
53+ _kind => return Err(Error::Other(err.into())),
54+ },
55+ };
4656
4757 // TODO: do we need bufreader/writer here? or do we use async wrappers on unblock?
4858 let writer = BufWriter::new(process.stdin.take().expect("Failed to open stdin"));
@@ -65,7 +75,7 @@ impl Client {
6575 // TODO: async client.initialize()
6676 // maybe use an arc<atomic> flag
6777
68− (client, incoming)
78+ Ok((client, incoming))
6979 }
7080
7181 fn next_request_id(&self) -> jsonrpc::Id {