Skip to content

fix: resolve pi binary on Windows (global paths + .cmd/.exe extension handling)#7

Merged
pi0 merged 2 commits into
pithings:mainfrom
Varun-Patkar:varun/fix-pi-windows
Apr 24, 2026
Merged

fix: resolve pi binary on Windows (global paths + .cmd/.exe extension handling)#7
pi0 merged 2 commits into
pithings:mainfrom
Varun-Patkar:varun/fix-pi-windows

Conversation

@Varun-Patkar
Copy link
Copy Markdown
Contributor

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:

  1. 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.

  2. Custom path setting hangs the terminal. When setting pi-vscode.path to something like C:\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

  • Added %APPDATA%\npm and %LOCALAPPDATA%\pnpm as Windows global candidate directories, checking for pi.cmd, pi.exe, and pi.ps1.
  • When a custom path is provided on Windows without a recognized executable extension, the resolver now probes for .cmd/.exe/.ps1 variants and uses the first one that exists on disk.
  • Added 6 new test cases covering both fixes.

@Varun-Patkar
Copy link
Copy Markdown
Contributor Author

Varun-Patkar commented Apr 24, 2026

Hi @pi0 /any other maintainers,
Could this PR be reviewed and merged?

Copy link
Copy Markdown
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thnx!

@pi0 pi0 merged commit b7f68d2 into pithings:main Apr 24, 2026
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.

Is this still maintained ?

2 participants