diff --git a/crates/util/src/shell_env.rs b/crates/util/src/shell_env.rs index 1b4d32851a2b07cd088457bc7a16b0db72f7a611..de9e1a0b260d38de3b8a453100d0b81738daaa2f 100644 --- a/crates/util/src/shell_env.rs +++ b/crates/util/src/shell_env.rs @@ -136,25 +136,24 @@ 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::Posix - | ShellKind::Csh - | ShellKind::Tcsh - | ShellKind::Rc - | ShellKind::Fish - | ShellKind::Xonsh = shell_kind + 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); let cmd = match shell_kind { - ShellKind::Posix - | ShellKind::Csh - | ShellKind::Tcsh - | ShellKind::Rc - | ShellKind::Fish - | ShellKind::Xonsh => { + ShellKind::Csh | ShellKind::Tcsh | ShellKind::Rc | ShellKind::Fish | ShellKind::Xonsh => { unreachable!() } + ShellKind::Posix => cmd.args([ + "-c", + &format!( + "cd '{}'; '{}' --printenv", + directory.display(), + zed_path.display() + ), + ]), ShellKind::PowerShell => cmd.args([ "-NonInteractive", "-NoProfile", @@ -168,7 +167,7 @@ async fn capture_windows( ShellKind::Elvish => cmd.args([ "-c", &format!( - "cd '{}'; {} --printenv", + "cd '{}'; '{}' --printenv", directory.display(), zed_path.display() ),