fix: resolve pi binary on Windows (global paths + .cmd/.exe extension handling)#7
Merged
Merged
Conversation
Contributor
Author
|
Hi @pi0 /any other maintainers, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6
I ran into this on my own system where the extension wouldn't find or launch pi on Windows. I needed it working so I dug in and fixed it. I won't be staying as a maintainer; just contributing this because it was broken for me.
Problem
Two issues on Windows:
No Windows global paths checked. The resolver only looked at Unix paths (
~/.bun/bin/pi,~/.local/bin/pi, etc.) and left the Windows global candidates list empty, so pi installed globally via npm/pnpm was never found.Custom path setting hangs the terminal. When setting
pi-vscode.pathto something likeC:\nvm4w\nodejs\pi, the extension tried to spawn that path directly. On Windows, that file is a bash shim (not a Windows executable), so the terminal just hung indefinitely.Fix
%APPDATA%\npmand%LOCALAPPDATA%\pnpmas Windows global candidate directories, checking forpi.cmd,pi.exe, andpi.ps1..cmd/.exe/.ps1variants and uses the first one that exists on disk.