From 14269d4720527f15a6a4fa7a2c2d36b90adbdd24 Mon Sep 17 00:00:00 2001 From: zino Date: Wed, 27 Nov 2024 20:16:54 +0800 Subject: [PATCH] chore: make lsp server spawning error more helpful by attachging a ctx --- src/app.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app.rs b/src/app.rs index f140898..04f81e7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -100,7 +100,7 @@ pub fn run_app_forever(client_reader: impl std::io::Read + Send + 'static, client_writer: impl std::io::Write + Send + 'static, mut server_cmd: std::process::Command, options: AppOptions) -> Result { - info!("Running server {:?}", server_cmd); + info!("About to run the lsp server with command {:?}", server_cmd); if let Some(ref bytecode_options) = options.bytecode_options { info!("Will convert server json to bytecode! bytecode options: {:?}", bytecode_options); } else { @@ -111,7 +111,13 @@ pub fn run_app_forever(client_reader: impl std::io::Read + Send + 'static, .stdin(std::process::Stdio::piped()) .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::inherit()) - .spawn()?; + .spawn() + .with_context(|| { + format!( + "Failed to run the lsp server with command: {:?}", + server_cmd + ) + })?; let (c2s_channel_pub, c2s_channel_sub) = mpsc::channel::(); let c2s_channel_counter = Arc::new(AtomicI32::new(0));