From ffefef90050d4e5ff753ee33e202adabc1c170e9 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:18:32 +0100 Subject: [PATCH] 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 --- crates/remote/src/transport/ssh.rs | 13 +++++++------ crates/remote/src/transport/wsl.rs | 12 +++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/crates/remote/src/transport/ssh.rs b/crates/remote/src/transport/ssh.rs index 433c4b017aac81b73b15d388518e6349632435f6..41885fd12cf5061d0b4230edb1565aafec77a28a 100644 --- a/crates/remote/src/transport/ssh.rs +++ b/crates/remote/src/transport/ssh.rs @@ -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], allow_pseudo_tty: bool, ) -> Result { - 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()) diff --git a/crates/remote/src/transport/wsl.rs b/crates/remote/src/transport/wsl.rs index bb0b6b0d9d4d4296a5a1863b6cc8d0ab39666906..52a1fa002298ba24bd1ad2c511a1c43945c11fde 100644 --- a/crates/remote/src/transport/wsl.rs +++ b/crates/remote/src/transport/wsl.rs @@ -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