Fix directory change lag (#672)

This commit is contained in:
JT
2022-01-05 16:50:27 +11:00
committed by GitHub
parent c158d29577
commit affb9696c7
5 changed files with 21 additions and 17 deletions

View File

@ -468,8 +468,11 @@ fn main() -> Result<()> {
}
// FIXME: permanent state changes like this hopefully in time can be removed
// and be replaced by just passing the cwd in where needed
let cwd = nu_engine::env::current_dir_str(&engine_state, &stack)?;
let _ = std::env::set_current_dir(cwd);
if let Some(cwd) = stack.get_env_var(&engine_state, "PWD") {
let path = cwd.as_string()?;
let _ = std::env::set_current_dir(path);
engine_state.env_vars.insert("PWD".into(), cwd);
}
}
Ok(Signal::CtrlC) => {
// `Reedline` clears the line content. New prompt is shown