Make remote mkdir shell-independent for compatibility (#32997)

- Closes: #30962 

Nushell does not support mkdir -p
So invoke sh -c "mkdir -p" instead which will also work under nushell.

Release Notes:

- Fixed ssh remotes running Nushell (and possibly other non
posix-compliant shells)

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
marton csutora 2025-06-25 05:21:59 +02:00 committed by GitHub
parent 17774b17fb
commit 014f93008a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1805,7 +1805,16 @@ impl SshRemoteConnection {
) -> Result<()> {
if let Some(parent) = tmp_path_gz.parent() {
self.socket
.run_command("mkdir", &["-p", &parent.to_string_lossy()])
.run_command(
"sh",
&[
"-c",
&shell_script!(
"mkdir -p {parent}",
parent = parent.to_string_lossy().as_ref()
),
],
)
.await?;
}
@ -1877,7 +1886,16 @@ impl SshRemoteConnection {
) -> Result<()> {
if let Some(parent) = tmp_path_gz.parent() {
self.socket
.run_command("mkdir", &["-p", &parent.to_string_lossy()])
.run_command(
"sh",
&[
"-c",
&shell_script!(
"mkdir -p {parent}",
parent = parent.to_string_lossy().as_ref()
),
],
)
.await?;
}