From 045c14593fdc01da566a9e89a08fdcf0bb23d204 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 11 Dec 2025 11:34:37 +0100 Subject: [PATCH] util: Honor shell args for shell env fetching on windows (#44615) Closes https://github.com/zed-industries/zed/issues/40464 Release Notes: - Fixed shell environment fetching on windows discarding specified arguments in settings --- crates/util/src/shell_env.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/util/src/shell_env.rs b/crates/util/src/shell_env.rs index c9a9b3515a699b55a84456bc1f5a139a54ccf614..c41a28b46953bdb87f319bfbbb84b7ebd22be245 100644 --- a/crates/util/src/shell_env.rs +++ b/crates/util/src/shell_env.rs @@ -132,7 +132,7 @@ async fn spawn_and_read_fd( #[cfg(windows)] async fn capture_windows( shell_path: &Path, - _args: &[String], + args: &[String], directory: &Path, ) -> Result> { use std::process::Stdio; @@ -141,17 +141,17 @@ async fn capture_windows( std::env::current_exe().context("Failed to determine current zed executable path.")?; let shell_kind = ShellKind::new(shell_path, true); - if let ShellKind::Csh | ShellKind::Tcsh | ShellKind::Rc | ShellKind::Fish | ShellKind::Xonsh = - shell_kind - { - return Err(anyhow::anyhow!("unsupported shell kind")); - } let mut cmd = crate::command::new_smol_command(shell_path); + cmd.args(args); let cmd = match shell_kind { - ShellKind::Csh | ShellKind::Tcsh | ShellKind::Rc | ShellKind::Fish | ShellKind::Xonsh => { - unreachable!() - } - ShellKind::Posix => cmd.args([ + ShellKind::Csh + | ShellKind::Tcsh + | ShellKind::Rc + | ShellKind::Fish + | ShellKind::Xonsh + | ShellKind::Posix => cmd.args([ + "-l", + "-i", "-c", &format!( "cd '{}'; '{}' --printenv",