Remove std::env::set_current_dir() call from EngineState::merge_env() (#12922)

As discussed in https://github.com/nushell/nushell/pull/12749, we no
longer need to call `std::env::set_current_dir()` to sync `$env.PWD`
with the actual working directory. This PR removes the call from
`EngineState::merge_env()`.
This commit is contained in:
YizhePKU
2024-05-23 00:58:27 +08:00
committed by GitHub
parent 75689ec98a
commit 7ede90cba5
10 changed files with 41 additions and 83 deletions

View File

@ -1,4 +1,3 @@
use crate::util::get_guaranteed_cwd;
use miette::Result;
use nu_engine::{eval_block, eval_block_with_early_return};
use nu_parser::parse;
@ -284,8 +283,7 @@ pub fn eval_hook(
}
}
let cwd = get_guaranteed_cwd(engine_state, stack);
engine_state.merge_env(stack, cwd)?;
engine_state.merge_env(stack)?;
Ok(output)
}