Skip to content

Conversation

@andrewflbarnes
Copy link

Fixes #1482 - inferences which fail when the path has a trailing slash or includes a space. Aligns the debug output for windows and unix.

Path with spaces

$ exec -a "/path with space/to/bash" bash

$ pid=$$; while [ -n "$pid" ]; do read pid prog <<< "$(ps -o ppid,comm -p $pid | awk 'NR == 2 {print}')"; echo $pid $prog; done
3634 /path with space/to/bash
1 /Users/xxxxx/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea
0 /sbin/launchd

$ RUST_LOG=debug cargo run -- env
...
[2025-12-02T22:42:18Z DEBUG fnm::shell::infer::unix] pid 28180 parent process 23954 : target/debug/fnm
[2025-12-02T22:42:18Z DEBUG fnm::shell::infer] binary is not a supported shell: "fnm"
[2025-12-02T22:42:18Z DEBUG fnm::shell::infer::unix] pid 23954 parent process 3634 : /path with space/to/bash
[2025-12-02T22:42:18Z DEBUG fnm::shell::infer::unix] Found supported shell: Bash
export PATH="/Users/xxxxxx/.local/state/fnm_multishells/28180_1764715338497/bin":"$PATH"

Trailing slash on symlink

$ exec /opt/homebrew/bin/bash/

$ pid=$$; while [ -n "$pid" ]; do read pid prog <<< "$(ps -o ppid,comm -p $pid | awk 'NR == 2 {print}')"; echo $pid $prog; done
3634 /opt/homebrew/bin/bash/
1 /Users/xxxxxx/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea
0 /sbin/launchd

$ RUST_LOG=debug cargo run -- env
...
[2025-12-02T22:50:32Z DEBUG fnm::shell::infer::unix] pid 31244 parent process 23954 : target/debug/fnm
[2025-12-02T22:50:32Z DEBUG fnm::shell::infer] binary is not a supported shell: "fnm"
[2025-12-02T22:50:32Z DEBUG fnm::shell::infer::unix] pid 23954 parent process 3634 : /opt/homebrew/bin/bash/
[2025-12-02T22:50:32Z DEBUG fnm::shell::infer::unix] Found supported shell: Bash
export PATH="/Users/xxxxxx/.local/state/fnm_multishells/31244_1764715832655/bin":"$PATH"

@changeset-bot
Copy link

changeset-bot bot commented Dec 2, 2025

🦋 Changeset detected

Latest commit: 6574931

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
fnm Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Dec 2, 2025

@andrewflbarnes is attempting to deploy a commit to the Gal Schlezinger's projects Team on Vercel.

A member of the Team first needs to authorize it.

@andrewflbarnes andrewflbarnes force-pushed the bugfix/linux-shell-inference branch from 82d58fd to b66dce0 Compare December 2, 2025 23:06
@andrewflbarnes andrewflbarnes force-pushed the bugfix/linux-shell-inference branch from b66dce0 to 6574931 Compare December 3, 2025 01:56
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 inference fails on commands (symlinks) invoked with trailing slash and paths with spaces

1 participant