remote: Fetch shell on ssh remote to use for preparing commands (#36690)

Prerequisite for https://github.com/zed-industries/zed/pull/36576 to
allow us to differentiate the shell in a remote.

Release Notes:

- N/A
This commit is contained in:
Lukas Wirth
2025-08-21 19:08:26 +02:00
committed by GitHub
parent 6f32d36ec9
commit b284b1a0b8
10 changed files with 121 additions and 52 deletions
+9 -4
View File
@@ -34,7 +34,7 @@ use http_client::HttpClient;
use language::{Buffer, LanguageToolchainStore, language_settings::InlayHintKind};
use node_runtime::NodeRuntime;
use remote::{SshRemoteClient, ssh_session::SshArgs};
use remote::{SshInfo, SshRemoteClient, ssh_session::SshArgs};
use rpc::{
AnyProtoClient, TypedEnvelope,
proto::{self},
@@ -254,14 +254,18 @@ impl DapStore {
cx.spawn(async move |_, cx| {
let response = request.await?;
let binary = DebugAdapterBinary::from_proto(response)?;
let (mut ssh_command, envs, path_style) =
let (mut ssh_command, envs, path_style, ssh_shell) =
ssh_client.read_with(cx, |ssh, _| {
let (SshArgs { arguments, envs }, path_style) =
ssh.ssh_info().context("SSH arguments not found")?;
let SshInfo {
args: SshArgs { arguments, envs },
path_style,
shell,
} = ssh.ssh_info().context("SSH arguments not found")?;
anyhow::Ok((
SshCommand { arguments },
envs.unwrap_or_default(),
path_style,
shell,
))
})??;
@@ -280,6 +284,7 @@ impl DapStore {
}
let (program, args) = wrap_for_ssh(
&ssh_shell,
&ssh_command,
binary
.command
@@ -117,7 +117,7 @@ impl DapLocator for CargoLocator {
.cwd
.clone()
.context("Couldn't get cwd from debug config which is needed for locators")?;
let builder = ShellBuilder::new(true, &build_config.shell).non_interactive();
let builder = ShellBuilder::new(None, &build_config.shell).non_interactive();
let (program, args) = builder.build(
Some("cargo".into()),
&build_config
@@ -126,7 +126,7 @@ impl DapLocator for CargoLocator {
.cloned()
.take_while(|arg| arg != "--")
.chain(Some("--message-format=json".to_owned()))
.collect(),
.collect::<Vec<_>>(),
);
let mut child = util::command::new_smol_command(program)
.args(args)