Skip to content

Commit bb13228

Browse files
authored
Revert "Remote: Change "sh -c" to "sh -lc" (#36760)" (#37417)
This reverts commit bf5ed6d. We believe this may be breaking some users whose shell initialization scripts change the working directory. Release Notes: - N/A
1 parent ec1528b commit bb13228

File tree

1 file changed

+6
-6
lines changed
  • crates/remote/src/transport

1 file changed

+6
-6
lines changed

crates/remote/src/transport/ssh.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl RemoteConnection for SshRemoteConnection {
254254

255255
let ssh_proxy_process = match self
256256
.socket
257-
.ssh_command("sh", &["-lc", &start_proxy_command])
257+
.ssh_command("sh", &["-c", &start_proxy_command])
258258
// IMPORTANT: we kill this process when we drop the task that uses it.
259259
.kill_on_drop(true)
260260
.spawn()
@@ -529,7 +529,7 @@ impl SshRemoteConnection {
529529
.run_command(
530530
"sh",
531531
&[
532-
"-lc",
532+
"-c",
533533
&shell_script!("mkdir -p {parent}", parent = parent.to_string().as_ref()),
534534
],
535535
)
@@ -607,7 +607,7 @@ impl SshRemoteConnection {
607607
.run_command(
608608
"sh",
609609
&[
610-
"-lc",
610+
"-c",
611611
&shell_script!("mkdir -p {parent}", parent = parent.to_string().as_ref()),
612612
],
613613
)
@@ -655,7 +655,7 @@ impl SshRemoteConnection {
655655
dst_path = &dst_path.to_string()
656656
)
657657
};
658-
self.socket.run_command("sh", &["-lc", &script]).await?;
658+
self.socket.run_command("sh", &["-c", &script]).await?;
659659
Ok(())
660660
}
661661

@@ -797,7 +797,7 @@ impl SshSocket {
797797
}
798798

799799
async fn platform(&self) -> Result<RemotePlatform> {
800-
let uname = self.run_command("sh", &["-lc", "uname -sm"]).await?;
800+
let uname = self.run_command("sh", &["-c", "uname -sm"]).await?;
801801
let Some((os, arch)) = uname.split_once(" ") else {
802802
anyhow::bail!("unknown uname: {uname:?}")
803803
};
@@ -828,7 +828,7 @@ impl SshSocket {
828828
}
829829

830830
async fn shell(&self) -> String {
831-
match self.run_command("sh", &["-lc", "echo $SHELL"]).await {
831+
match self.run_command("sh", &["-c", "echo $SHELL"]).await {
832832
Ok(shell) => shell.trim().to_owned(),
833833
Err(e) => {
834834
log::error!("Failed to get shell: {e}");

0 commit comments

Comments
 (0)