From 44c6382e138bf587a347370297620617949b0483 Mon Sep 17 00:00:00 2001 From: Todd L Smith Date: Mon, 28 Jul 2025 12:00:41 -0500 Subject: [PATCH] Fix Nushell environment variables (#35166) - Fixes environment variable ingestion for Nushell. Closes #35056 Release Notes: - N/A --- crates/util/src/shell_env.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/util/src/shell_env.rs b/crates/util/src/shell_env.rs index ed6c8a23cc644e2991e3c999b5c68093e3a3eb49..6c5eeb6b79e6d155e03c69576b651b630f82078b 100644 --- a/crates/util/src/shell_env.rs +++ b/crates/util/src/shell_env.rs @@ -30,6 +30,7 @@ pub fn capture(directory: &std::path::Path) -> Result { // For csh/tcsh, login shell requires passing `-` as 0th argument (instead of `-l`) @@ -40,13 +41,20 @@ pub fn capture(directory: &std::path::Path) -> Result { + // nu needs special handling for -- options. + command_prefix = String::from("^"); + } _ => { command.arg("-l"); } } // cd into the directory, triggering directory specific side-effects (asdf, direnv, etc) command_string.push_str(&format!("cd '{}';", directory.display())); - command_string.push_str(&format!("{} --printenv {}", zed_path, redir)); + command_string.push_str(&format!( + "{}{} --printenv {}", + command_prefix, zed_path, redir + )); command.args(["-i", "-c", &command_string]); super::set_pre_exec_to_start_new_session(&mut command);