From 08ab5e57ea62c6b51d46f51c995443edec25d872 Mon Sep 17 00:00:00 2001 From: timzaak Date: Tue, 6 Jan 2026 16:48:49 +0800 Subject: [PATCH] feat: windows support pwsh 7, and push environment in the shell --- crates/sshx/src/terminal/windows.rs | 7 +++++++ 1 file changed, 7 insertions(+) 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");