Skip to content

fix(shell): use POSIX file tests in bash --use-on-cd hook - #1593

Open
vulragrag-star wants to merge 1 commit into
Schniz:masterfrom
vulragrag-star:fix/fnm-1591-posix-use-on-cd
Open

vulragrag-star wants to merge 1 commit into
Schniz:masterfrom
vulragrag-star:fix/fnm-1591-posix-use-on-cd

Conversation

@vulragrag-star

Copy link
Copy Markdown

Summary

Bash --use-on-cd emitted if [[ -f .node-version || ... ]]; then, which is not POSIX. Under dash/sh that errors as [[: not found and the hook never runs fnm use.

Switch the generated condition to POSIX [ -f ... ] || [ -f ... ] tests (valid in bash and sh).

Fixes #1591

Test plan

  • cargo test use_on_cd_emits_posix_file_tests
  • Existing e2e/use-on-cd.test.ts bash matrix still passes

Bash's generated cd hook used `[[ -f ... ]]`, which fails under dash/sh
(`[[: not found`) so --use-on-cd silently never runs `fnm use`. Emit
POSIX `[ -f ]` tests instead (valid in bash and sh).

Fixes Schniz#1591

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.

fnm env --use-on-cd emits bash-only [[ ]] syntax with no POSIX sh option

2 participants