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 {