From 9ff98da93c69013274322c3a63dfdb1beaf73875 Mon Sep 17 00:00:00 2001 From: Charles Bayley Date: Mon, 27 May 2024 10:28:53 -0400 Subject: [PATCH] This $PATH should be wrapped in quotes so it will work with spaces (#1066) * This $PATH should be wrapped in quotes so it will work with spaces * patch changeset for 1066 --------- Co-authored-by: Gal Schlezinger --- .changeset/violet-rice-brake.md | 5 +++++ src/shell/bash.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/violet-rice-brake.md diff --git a/.changeset/violet-rice-brake.md b/.changeset/violet-rice-brake.md new file mode 100644 index 0000000..e6fb4eb --- /dev/null +++ b/.changeset/violet-rice-brake.md @@ -0,0 +1,5 @@ +--- +"fnm": patch +--- + +Fixes a bug when running `eval $(fnm env)` in sh when there a spaces in the $PATH diff --git a/src/shell/bash.rs b/src/shell/bash.rs index 016809e..81851e4 100644 --- a/src/shell/bash.rs +++ b/src/shell/bash.rs @@ -18,7 +18,7 @@ impl Shell for Bash { .ok_or_else(|| anyhow::anyhow!("Can't convert path to string"))?; let path = super::windows_compat::maybe_fix_windows_path(path).unwrap_or_else(|| path.to_string()); - Ok(format!("export PATH={path:?}:$PATH")) + Ok(format!("export PATH={path:?}:\"$PATH\"")) } fn set_env_var(&self, name: &str, value: &str) -> String {