Skip to content

Commit 68809b7

Browse files
kingananas20xipeng-jin
authored andcommitted
Fixed nushell error when creating new folder when uploading wsl-remote-server (zed-industries#40432)
Closes zed-industries#40269 Release Notes: - N/A
1 parent 19f3df2 commit 68809b7

File tree

1 file changed

+11
-5
lines changed
  • crates/remote/src/transport

1 file changed

+11
-5
lines changed

crates/remote/src/transport/wsl.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl WslRemoteConnection {
206206
))
207207
.unwrap(),
208208
);
209-
self.upload_file(&remote_server_path, &tmp_path, delegate, cx)
209+
self.upload_file(&remote_server_path, &tmp_path, delegate, &shell, cx)
210210
.await?;
211211
self.extract_and_install(&tmp_path, &dst_path, delegate, cx)
212212
.await?;
@@ -239,7 +239,8 @@ impl WslRemoteConnection {
239239
);
240240
let tmp_path = RelPath::unix(&tmp_path).unwrap();
241241

242-
self.upload_file(&src_path, &tmp_path, delegate, cx).await?;
242+
self.upload_file(&src_path, &tmp_path, delegate, &shell, cx)
243+
.await?;
243244
self.extract_and_install(&tmp_path, &dst_path, delegate, cx)
244245
.await?;
245246

@@ -251,14 +252,19 @@ impl WslRemoteConnection {
251252
src_path: &Path,
252253
dst_path: &RelPath,
253254
delegate: &Arc<dyn RemoteClientDelegate>,
255+
shell: &ShellKind,
254256
cx: &mut AsyncApp,
255257
) -> Result<()> {
256258
delegate.set_status(Some("Uploading remote server to WSL"), cx);
257259

258260
if let Some(parent) = dst_path.parent() {
259-
self.run_wsl_command("mkdir", &["-p", &parent.display(PathStyle::Posix)])
260-
.await
261-
.map_err(|e| anyhow!("Failed to create directory when uploading file: {}", e))?;
261+
let parent = parent.display(PathStyle::Posix);
262+
if *shell == ShellKind::Nushell {
263+
self.run_wsl_command("mkdir", &[&parent]).await
264+
} else {
265+
self.run_wsl_command("mkdir", &["-p", &parent]).await
266+
}
267+
.map_err(|e| anyhow!("Failed to create directory when uploading file: {}", e))?;
262268
}
263269

264270
let t0 = Instant::now();

0 commit comments

Comments
 (0)