remote: More nushell fixes (#42608) (cherry-pick to stable) (#42610)

Cherry-pick of #42608 to stable

----
Closes https://github.com/zed-industries/zed/issues/42594

Release Notes:

- Fixed remote server installation failing with nutshell

Co-authored-by: Lukas Wirth <lukas@zed.dev>
This commit is contained in:
zed-zippy[bot]
2025-11-13 11:18:32 +01:00
committed by GitHub
parent 70d909449b
commit ffefef9005
2 changed files with 16 additions and 9 deletions

View File

@@ -487,7 +487,9 @@ impl SshRemoteConnection {
drop(askpass);
let ssh_shell = socket.shell().await;
log::info!("Remote shell discovered: {}", ssh_shell);
let ssh_platform = socket.platform(ShellKind::new(&ssh_shell, false)).await?;
log::info!("Remote platform discovered: {}", ssh_shell);
let ssh_path_style = match ssh_platform.os {
"windows" => PathStyle::Windows,
_ => PathStyle::Posix,
@@ -622,7 +624,7 @@ impl SshRemoteConnection {
}
Err(e) => {
log::error!(
"Failed to download binary on server, attempting to upload server: {e:#}",
"Failed to download binary on server, attempting to download locally and then upload it the server: {e:#}",
)
}
}
@@ -695,6 +697,7 @@ impl SshRemoteConnection {
return Err(e);
}
log::info!("curl is not available, trying wget");
match self
.socket
.run_command(
@@ -987,13 +990,11 @@ impl SshSocket {
args: &[impl AsRef<str>],
allow_pseudo_tty: bool,
) -> Result<String> {
let output = self
.ssh_command(shell_kind, program, args, allow_pseudo_tty)
.output()
.await?;
let mut command = self.ssh_command(shell_kind, program, args, allow_pseudo_tty);
let output = command.output().await?;
anyhow::ensure!(
output.status.success(),
"failed to run command: {}",
"failed to run command {command:?}: {}",
String::from_utf8_lossy(&output.stderr)
);
Ok(String::from_utf8_lossy(&output.stdout).to_string())

View File

@@ -84,12 +84,15 @@ impl WslRemoteConnection {
.detect_shell()
.await
.context("failed detecting shell")?;
log::info!("Remote shell discovered: {}", this.shell);
this.shell_kind = ShellKind::new(&this.shell, false);
this.can_exec = this.detect_can_exec().await;
log::info!("Remote can exec: {}", this.can_exec);
this.platform = this
.detect_platform()
.await
.context("failed detecting platform")?;
log::info!("Remote platform discovered: {}", this.shell);
this.remote_binary_path = Some(
this.ensure_server_binary(&delegate, release_channel, version, commit, cx)
.await
@@ -178,7 +181,8 @@ impl WslRemoteConnection {
if let Some(parent) = dst_path.parent() {
let parent = parent.display(PathStyle::Posix);
self.run_wsl_command("mkdir", &["-p", &parent])
let mkdir = self.shell_kind.prepend_command_prefix("mkdir");
self.run_wsl_command(&mkdir, &["-p", &parent])
.await
.map_err(|e| anyhow!("Failed to create directory: {}", e))?;
}
@@ -246,7 +250,8 @@ impl WslRemoteConnection {
if let Some(parent) = dst_path.parent() {
let parent = parent.display(PathStyle::Posix);
self.run_wsl_command("mkdir", &["-p", &parent])
let mkdir = self.shell_kind.prepend_command_prefix("mkdir");
self.run_wsl_command(&mkdir, &["-p", &parent])
.await
.map_err(|e| anyhow!("Failed to create directory when uploading file: {}", e))?;
}
@@ -261,8 +266,9 @@ impl WslRemoteConnection {
);
let src_path_in_wsl = self.windows_path_to_wsl_path(src_path).await?;
let cp = self.shell_kind.prepend_command_prefix("cp");
self.run_wsl_command(
"cp",
&cp,
&["-f", &src_path_in_wsl, &dst_path.display(PathStyle::Posix)],
)
.await