From 1f7ff956bcef31f93db4b9841737c0bc893bafc9 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Thu, 24 Jul 2025 14:29:28 -0400 Subject: [PATCH] Fix environment loading with nushell (#35002) Closes https://github.com/zed-industries/zed/issues/34739 I believe this is a regression introduced here: - https://github.com/zed-industries/zed/pull/33599 Release Notes: - Fixed a regression with loading environment variables in nushell --- crates/util/src/shell_env.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/util/src/shell_env.rs b/crates/util/src/shell_env.rs index 21f6096f19..ed6c8a23cc 100644 --- a/crates/util/src/shell_env.rs +++ b/crates/util/src/shell_env.rs @@ -18,10 +18,13 @@ pub fn capture(directory: &std::path::Path) -> Result format!(">[1={}]", ENV_OUTPUT_FD), // `[1=0]` - _ => format!(">&{}", ENV_OUTPUT_FD), // `>&0` + const FD_STDIN: std::os::fd::RawFd = 0; + const FD_STDOUT: std::os::fd::RawFd = 1; + + let (fd_num, redir) = match shell_name { + Some("rc") => (FD_STDIN, format!(">[1={}]", FD_STDIN)), // `[1=0]` + Some("nu") => (FD_STDOUT, "".to_string()), + _ => (FD_STDIN, format!(">&{}", FD_STDIN)), // `>&0` }; command.stdin(Stdio::null()); command.stdout(Stdio::piped()); @@ -48,7 +51,7 @@ pub fn capture(directory: &std::path::Path) -> Result