diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rs index ac4e890aaddfa68ec60e94167e55485a561c76c2..37b29c2a1d951b8defad84fe8df2b03015f6f745 100644 --- a/crates/project/src/terminals.rs +++ b/crates/project/src/terminals.rs @@ -6,6 +6,7 @@ use itertools::Itertools; use settings::{Settings, SettingsLocation}; use smol::channel::bounded; use std::{ + borrow::Cow, env::{self}, iter, path::{Path, PathBuf}, @@ -341,10 +342,9 @@ pub fn wrap_for_ssh( venv_directory: Option, ) -> (String, Vec) { let to_run = if let Some((command, args)) = command { - iter::once(command) - .chain(args) - .filter_map(|arg| shlex::try_quote(arg).ok()) - .join(" ") + let command = Cow::Borrowed(command.as_str()); + let args = args.iter().filter_map(|arg| shlex::try_quote(arg).ok()); + iter::once(command).chain(args).join(" ") } else { "exec ${SHELL:-sh} -l".to_string() }; @@ -390,9 +390,7 @@ pub fn wrap_for_ssh( SshCommand::Direct(ssh_args) => ("ssh".to_string(), ssh_args.clone()), }; - if command.is_none() { - args.push("-t".to_string()) - } + args.push("-t".to_string()); args.push(shell_invocation); (program, args) } diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index 7d95613804414c91acbe11bcd680251f0b728d7c..5097cbc28a4ae39ad8d9c94f10394a31cb66e7c8 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -395,7 +395,21 @@ impl TerminalPanel { let mut spawn_task = spawn_in_terminal.clone(); // Set up shell args unconditionally, as tasks are always spawned inside of a shell. let Some((shell, mut user_args)) = (match spawn_in_terminal.shell.clone() { - Shell::System => retrieve_system_shell().map(|shell| (shell, Vec::new())), + Shell::System => { + match self + .workspace + .update(cx, |workspace, cx| workspace.project().read(cx).is_local()) + { + Ok(local) => { + if local { + retrieve_system_shell().map(|shell| (shell, Vec::new())) + } else { + Some(("\"${SHELL:-sh}\"".to_string(), Vec::new())) + } + } + Err(_no_window_e) => return, + } + } Shell::Program(shell) => Some((shell, Vec::new())), Shell::WithArguments { program, args } => Some((program, args)), }) else {