From 27ebccce80d8dc909a4d7c44aa27b3faaa0de5b6 Mon Sep 17 00:00:00 2001 From: Douglas <32344964+NotTheDr01ds@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:42:44 -0400 Subject: [PATCH] Set proc/env cwd to engine_state value (#14005) # Description Fixes #14000 by once again calling `set_current_dir()`, but doing so with the `cwd` from the current state, rather than the (previously removed) argument to `merge_env()`. # User-Facing Changes Bug fix # Tests + Formatting If this looks good, I'll look at adding a test case for it. - :green_circle: `toolkit fmt` - :green_circle: `toolkit clippy` - :green_circle: `toolkit test` - :green_circle: `toolkit test stdlib` # After Submitting N/A --- crates/nu-protocol/src/engine/engine_state.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/nu-protocol/src/engine/engine_state.rs b/crates/nu-protocol/src/engine/engine_state.rs index ec616c3403..71c1a58905 100644 --- a/crates/nu-protocol/src/engine/engine_state.rs +++ b/crates/nu-protocol/src/engine/engine_state.rs @@ -320,6 +320,10 @@ impl EngineState { } } + let cwd = self.cwd(Some(stack))?; + // TODO: better error + std::env::set_current_dir(cwd)?; + if let Some(config) = stack.config.take() { // If config was updated in the stack, replace it. self.config = config;