rust: Test rust-analyzer binary after finding in PATH (#17951)

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Thorsten Ball 2024-09-17 19:45:29 +02:00 committed by GitHub
parent ee8668ef45
commit ccfd4b1887
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 47 additions and 1 deletions

View file

@ -7133,6 +7133,30 @@ impl LspAdapterDelegate for ProjectLspAdapterDelegate {
which::which(command).ok()
}
async fn try_exec(&self, command: LanguageServerBinary) -> Result<()> {
if self.fs.is_none() {
return Ok(());
}
let working_dir = self.worktree_root_path();
let output = smol::process::Command::new(&command.path)
.args(command.arguments)
.envs(command.env.clone().unwrap_or_default())
.current_dir(working_dir)
.output()
.await?;
if output.status.success() {
return Ok(());
}
Err(anyhow!(
"{}, stdout: {:?}, stderr: {:?}",
output.status,
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
))
}
fn update_status(
&self,
server_name: LanguageServerName,