From c475be2df8c5f98f49a1a9e80bcf6f4e242f79c7 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Sun, 17 May 2020 22:22:54 -0700 Subject: [PATCH] Fix starship not getting the correct pwd (#1822) --- crates/nu-cli/src/cli.rs | 1 + crates/nu-cli/src/shell/filesystem_shell.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/nu-cli/src/cli.rs b/crates/nu-cli/src/cli.rs index 901c2c9d92..dfcfb294f0 100644 --- a/crates/nu-cli/src/cli.rs +++ b/crates/nu-cli/src/cli.rs @@ -592,6 +592,7 @@ pub async fn cli( #[cfg(feature = "starship-prompt")] { std::env::set_var("STARSHIP_SHELL", ""); + std::env::set_var("PWD", &cwd); let mut starship_context = starship::context::Context::new_with_dir(clap::ArgMatches::default(), cwd); diff --git a/crates/nu-cli/src/shell/filesystem_shell.rs b/crates/nu-cli/src/shell/filesystem_shell.rs index 66c60953d0..3aac323d3b 100644 --- a/crates/nu-cli/src/shell/filesystem_shell.rs +++ b/crates/nu-cli/src/shell/filesystem_shell.rs @@ -648,6 +648,7 @@ impl Shell for FilesystemShell { let path = match canonicalize(self.path(), pathbuf.as_path()) { Ok(path) => { let _ = std::env::set_current_dir(&path); + std::env::set_var("PWD", &path); path } _ => {