Skip to content

Fix directory-change hooks when fnm is outside PATH - #1594

Open
pederbe wants to merge 1 commit into
Schniz:masterfrom
pederbe:learn/1210-absolute-hook-path
Open

pederbe wants to merge 1 commit into
Schniz:masterfrom
pederbe:learn/1210-absolute-hook-path

Conversation

@pederbe

@pederbe pederbe commented Sep 12, 2026

Copy link
Copy Markdown

When fnm env --use-on-cd is invoked by an absolute path, setup can succeed but the next directory change fails if fnm is absent from PATH.

Capture the setup executable for Bash, Zsh, Fish, and PowerShell hooks and use it as a fallback when shell-resolved fnm is unavailable. Keep existing shell wrappers and PATH-based invocations preferred, and preserve explicit symlink paths. Add real-shell regressions for absolute and relative invocation, local and recursive version lookup, repeated setup, and executable paths containing spaces, Unicode, and shell metacharacters.

Cmd remains unchanged because its batch hooks need separate encoding handling to support Unicode executable paths safely.

Fixes #1210.

@pederbe
pederbe marked this pull request as ready for review September 12, 2026 08:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell script generated with absolute path ignores absolute path: fnm env --use-on-cd

1 participant