Fixed nushell error when creating new folder when uploading wsl-remote-server (#40432)

Closes #40269 

Release Notes:

- N/A
This commit is contained in:
kingananas20
2025-10-16 22:46:30 +00:00
committed by GitHub
parent e85c060625
commit cd51efad9e
+11 -5
View File
@@ -206,7 +206,7 @@ impl WslRemoteConnection {
)) ))
.unwrap(), .unwrap(),
); );
self.upload_file(&remote_server_path, &tmp_path, delegate, cx) self.upload_file(&remote_server_path, &tmp_path, delegate, &shell, cx)
.await?; .await?;
self.extract_and_install(&tmp_path, &dst_path, delegate, cx) self.extract_and_install(&tmp_path, &dst_path, delegate, cx)
.await?; .await?;
@@ -239,7 +239,8 @@ impl WslRemoteConnection {
); );
let tmp_path = RelPath::unix(&tmp_path).unwrap(); 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) self.extract_and_install(&tmp_path, &dst_path, delegate, cx)
.await?; .await?;
@@ -251,14 +252,19 @@ impl WslRemoteConnection {
src_path: &Path, src_path: &Path,
dst_path: &RelPath, dst_path: &RelPath,
delegate: &Arc<dyn RemoteClientDelegate>, delegate: &Arc<dyn RemoteClientDelegate>,
shell: &ShellKind,
cx: &mut AsyncApp, cx: &mut AsyncApp,
) -> Result<()> { ) -> Result<()> {
delegate.set_status(Some("Uploading remote server to WSL"), cx); delegate.set_status(Some("Uploading remote server to WSL"), cx);
if let Some(parent) = dst_path.parent() { if let Some(parent) = dst_path.parent() {
self.run_wsl_command("mkdir", &["-p", &parent.display(PathStyle::Posix)]) let parent = parent.display(PathStyle::Posix);
.await if *shell == ShellKind::Nushell {
.map_err(|e| anyhow!("Failed to create directory when uploading file: {}", e))?; 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(); let t0 = Instant::now();