diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 19dd5c62f9dcaa85610c4f9ebba277863faaa340..9cbfddb24657be9f63fc8417f3e22d8d89b90f2b 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -445,7 +445,7 @@ impl TerminalBuilder { struct ShellParams { program: String, args: Option>, - title_override: Option, + title_override: Option, } impl ShellParams { @@ -493,7 +493,6 @@ impl TerminalBuilder { .log_err() .unwrap_or(params.program.clone()) }); - dbg!(&alac_shell); // Note: when remoting, this shell_kind will scrutinize `ssh` or // `wsl.exe` as a shell and fall back to posix or powershell based on @@ -509,16 +508,15 @@ impl TerminalBuilder { params.args.clone().unwrap_or_default(), ) }); + dbg!(&alac_shell); alacritty_terminal::tty::Options { shell: alac_shell, working_directory: working_directory.clone(), drain_on_exit: true, env: env.clone().into_iter().collect(), - // We do not want to escape arguments if we are using CMD as our shell. - // If we do we end up with too many quotes/escaped quotes for CMD to handle. #[cfg(windows)] - escape_args: shell_kind != util::shell::ShellKind::Cmd, + escape_args: shell_kind.tty_escape_args(), } }; diff --git a/crates/util/src/shell.rs b/crates/util/src/shell.rs index a6a7416429ab36d6ee552c221cc5400eae5a999c..7f7c0a1ce335d2c15fd035a1e21770fd76823af8 100644 --- a/crates/util/src/shell.rs +++ b/crates/util/src/shell.rs @@ -462,6 +462,23 @@ impl ShellKind { | ShellKind::Xonsh => "clear", } } + + #[cfg(windows)] + /// We do not want to escape arguments if we are using CMD as our shell. + /// If we do we end up with too many quotes/escaped quotes for CMD to handle. + pub const fn tty_escape_args(&self) -> bool { + match self { + ShellKind::Cmd => false, + ShellKind::Posix + | ShellKind::Csh + | ShellKind::Tcsh + | ShellKind::Rc + | ShellKind::Fish + | ShellKind::PowerShell + | ShellKind::Nushell + | ShellKind::Xonsh => true, + } + } } #[cfg(test)]