From 2bc1d60c5274379a5ee4133d1db3f3ff6a094c95 Mon Sep 17 00:00:00 2001 From: Smit Barmase Date: Wed, 5 Nov 2025 18:15:15 +0530 Subject: [PATCH] remote: Fix open terminal fails when $SHELL is not set (#41990) Closes #41644 Release Notes: - Fixed issue where it failed to spawn terminal on systems such as Alpine. --- crates/remote/src/transport/ssh.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/remote/src/transport/ssh.rs b/crates/remote/src/transport/ssh.rs index 18a4f64de28d1665deb4c788d7e4673e1e3b9ec5..70f1fd5e11bd0827f98be70a92e4338b75cef639 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() } } }