Skip to content

Quote the pixi executable path when spawning with shell: true - #57

Open
SIDLAD wants to merge 1 commit into
prefix-dev:mainfrom
SIDLAD:fix/quote-pixi-executable-path
Open

SIDLAD wants to merge 1 commit into
prefix-dev:mainfrom
SIDLAD:fix/quote-pixi-executable-path

Conversation

@SIDLAD

@SIDLAD SIDLAD commented Nov 8, 2026

Copy link
Copy Markdown

Pixi's executable path was not quoted, so a space in it (for example C:\Users\First Last\...) broke every Pixi call. I tested the issue and the fix on my laptop (Windows 11, username is two space-separated words), and the fix worked.


AI-assisted details (written with Claude Code)

Fixes #8.

Change (src/pixi/utils.ts, 2 lines)

-import { quoteArgs } from '../common/execUtils';
+import { quoteArgs, quoteStringIfNecessary } from '../common/execUtils';
-    const proc = ch.spawn(pixi, args, { shell: true, ...options });
+    const proc = ch.spawn(quoteStringIfNecessary(pixi), args, { shell: true, ...options });
  • This reuses the existing helper. Paths without spaces are left unchanged.
  • The quoting is applied only at the spawn call. The unquoted path still goes into execInfo, so tools that spawn without a shell (e.g. Black Formatter) keep working. Users who applied the "quote the setting" workaround should remove the quotes, because quoted values break those tools (see the Fails on Windows, when there is a space in the home directory path #8 comment).
  • shell: true is intentionally kept as is. Moving to shell: false would change behaviour and is out of scope.

Checks

  • npm run lint, npm run format:check and npm run compile all pass.

Testing

  • Windows 11, Pixi 0.84.1, Python Environments 1.42.0. Pixi auto-discovered at C:\Users\First Last\.pixi\bin\pixi.EXE (pixiExecutable empty), project on D:\.
    • Before (released 0.2.0): 'C:\Users\First' is not recognized … in the Pixi Environment Manager output, and no Pixi environments.
    • After (this branch, run via F5 / Extension Development Host): pixi --version succeeds during activation, the Pixi manager registers, LearningMLDL:default is listed under Pixi, and a cmd terminal activates it with "C:\…\pixi.EXE" shell --manifest-path … -e default.

Notes

  • Improve Pixi environment discovery #45 also edits src/pixi/utils.ts but not this line, so any conflict should be trivial.
  • PowerShell terminal activation has a related but separate problem with spaced paths. It's addressed in a separate PR.

🤖 Generated with Claude Code

On Windows, spawning pixi with shell: true failed when the executable
path contained a space (e.g. C:\Users\First Last\.pixi\bin\pixi.exe),
because only the arguments were quoted. Quote the executable with the
existing quoteStringIfNecessary helper.

Fixes prefix-dev#8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Fails on Windows, when there is a space in the home directory path

1 participant