Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

remote: Fix open terminal fails when $SHELL is not set (#41990)

Smit Barmase2bc1d60c5274
diff --git a/crates/remote/src/transport/ssh.rs b/crates/remote/src/transport/ssh.rs
index 18a4f64de28..70f1fd5e11b 100644
--- a/crates/remote/src/transport/ssh.rs
+++ b/crates/remote/src/transport/ssh.rs
@@ -1070,14 +1070,21 @@ impl SshSocket {
}
async fn shell(&self) -> String {
+ let default_shell = "sh";
match self
.run_command(ShellKind::Posix, "sh", &["-c", "echo $SHELL"])
.await
{
- Ok(shell) => shell.trim().to_owned(),
+ Ok(shell) => match shell.trim() {
+ "" => {
+ log::error!("$SHELL is not set, falling back to {default_shell}");
+ default_shell.to_owned()
+ }
+ shell => shell.to_owned(),
+ },
Err(e) => {
log::error!("Failed to get shell: {e}");
- "sh".to_owned()
+ default_shell.to_owned()
}
}
}