Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

util: Fix shell environment fetching failing with nu (#40275)

Lukas Wirth9948778e9686
diff --git a/crates/project/src/environment.rs b/crates/project/src/environment.rs
index 50fd3956a75..3d42bb217fa 100644
--- a/crates/project/src/environment.rs
+++ b/crates/project/src/environment.rs
@@ -263,7 +263,7 @@ async fn load_shell_environment(
.into_iter()
.collect();
(Some(fake_env), None)
- } else if cfg!(target_os = "windows",) {
+ } else if cfg!(target_os = "windows") {
let (shell, args) = shell.program_and_args();
let envs = match shell_env::capture(shell, args, dir).await {
Ok(envs) => envs,
diff --git a/crates/util/src/shell.rs b/crates/util/src/shell.rs
index bcce6b784ba..a031f98fc27 100644
--- a/crates/util/src/shell.rs
+++ b/crates/util/src/shell.rs
@@ -45,6 +45,7 @@ pub fn get_windows_git_bash() -> Option<String> {
let git = which::which("git").ok()?;
let git_bash = git.parent()?.parent()?.join("bin").join("bash.exe");
if git_bash.is_file() {
+ log::info!("Found git-bash at {}", git_bash.display());
Some(git_bash.to_string_lossy().to_string())
} else {
None
diff --git a/crates/util/src/shell_env.rs b/crates/util/src/shell_env.rs
index 541c7f5e48f..a82bea154ec 100644
--- a/crates/util/src/shell_env.rs
+++ b/crates/util/src/shell_env.rs
@@ -177,8 +177,12 @@ async fn capture_windows(
.args([
"-c",
&format!(
- "cd '{}'; {} --printenv",
+ "cd '{}'; {}{} --printenv",
directory.display(),
+ shell_kind
+ .command_prefix()
+ .map(|prefix| prefix.to_string())
+ .unwrap_or_default(),
zed_path.display()
),
])