diff --git a/crates/sshx/src/terminal/windows.rs b/crates/sshx/src/terminal/windows.rs index 094ff38..b4ffe93 100644 --- a/crates/sshx/src/terminal/windows.rs +++ b/crates/sshx/src/terminal/windows.rs @@ -19,6 +19,7 @@ use tracing::instrument; /// for Powershell to launch. This is why I don't typically use Windows! pub async fn get_default_shell() -> String { for shell in [ + "C:\\Program Files\\PowerShell\\7\\pwsh.exe", "C:\\Program Files\\Git\\bin\\bash.exe", "C:\\Windows\\System32\\cmd.exe", ] { @@ -46,6 +47,12 @@ impl Terminal { pub async fn new(shell: &str) -> Result { let mut command = Command::new(shell); + // Inherit all environment variables from the current process. + // This ensures PATH and other important variables are preserved. + for (key, value) in std::env::vars() { + command.env(key, value); + } + // Set terminal environment variables appropriately. command.env("TERM", "xterm-256color"); command.env("COLORTERM", "truecolor");