From cd51efad9e7012ca64a3400a884dc0fb60354bf3 Mon Sep 17 00:00:00 2001 From: kingananas20 <105493588+kingananas20@users.noreply.github.com> Date: Fri, 17 Oct 2025 00:46:30 +0200 Subject: [PATCH] Fixed nushell error when creating new folder when uploading wsl-remote-server (#40432) Closes #40269 Release Notes: - N/A --- crates/remote/src/transport/wsl.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/remote/src/transport/wsl.rs b/crates/remote/src/transport/wsl.rs index f5a86fd16f0b630bedcb7a325eaacd23eae0ca15..a2ed840a95f56c4610c9ad479606b3fb371aeaab 100644 --- a/crates/remote/src/transport/wsl.rs +++ b/crates/remote/src/transport/wsl.rs @@ -206,7 +206,7 @@ impl WslRemoteConnection { )) .unwrap(), ); - self.upload_file(&remote_server_path, &tmp_path, delegate, cx) + self.upload_file(&remote_server_path, &tmp_path, delegate, &shell, cx) .await?; self.extract_and_install(&tmp_path, &dst_path, delegate, cx) .await?; @@ -239,7 +239,8 @@ impl WslRemoteConnection { ); let tmp_path = RelPath::unix(&tmp_path).unwrap(); - self.upload_file(&src_path, &tmp_path, delegate, cx).await?; + self.upload_file(&src_path, &tmp_path, delegate, &shell, cx) + .await?; self.extract_and_install(&tmp_path, &dst_path, delegate, cx) .await?; @@ -251,14 +252,19 @@ impl WslRemoteConnection { src_path: &Path, dst_path: &RelPath, delegate: &Arc, + shell: &ShellKind, cx: &mut AsyncApp, ) -> Result<()> { delegate.set_status(Some("Uploading remote server to WSL"), cx); if let Some(parent) = dst_path.parent() { - self.run_wsl_command("mkdir", &["-p", &parent.display(PathStyle::Posix)]) - .await - .map_err(|e| anyhow!("Failed to create directory when uploading file: {}", e))?; + let parent = parent.display(PathStyle::Posix); + if *shell == ShellKind::Nushell { + self.run_wsl_command("mkdir", &[&parent]).await + } else { + self.run_wsl_command("mkdir", &["-p", &parent]).await + } + .map_err(|e| anyhow!("Failed to create directory when uploading file: {}", e))?; } let t0 = Instant::now();