fix(lsp): spawn + discover npm/pip language servers on native Windows#35250
Merged
Conversation
asyncio.create_subprocess_exec cannot run .cmd/.bat files on Windows because CreateProcess expects a valid PE executable. npm-installed LSP servers (intelephense, typescript-language-server, etc.) ship as .cmd shims on Windows, causing WinError 193 on spawn. Detect .cmd/.bat extensions and wrap with cmd.exe /c before spawning. Gated behind sys.platform == 'win32' — no code path changes elsewhere. Fixes #34864
Contributor
🔎 Lint report:
|
Collaborator
This was referenced May 30, 2026
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.
Summary
npm-installed language servers now spawn on native Windows instead of dying with
WinError 193.Two complementary fixes, salvaged onto current
main:asyncio.create_subprocess_execcan't run.cmd/.batshims —CreateProcessonly accepts PE executables. npm wraps every JS LSP (typescript-language-server, intelephense, vue, svelte, …) as a.cmdshim, so spawning failed. Now wrapped withcmd.exe /cat the spawn boundary._existing_binary()recognizes Windows.cmd/.exe/.batlauncher variants (staged + PATH), npm output undernode_modules/.bin, and pip console scripts underScripts/.Both are gated on Windows; no code-path change on Linux/macOS.
Changes
agent/lsp/client.py:_win_wrap_cmd()static helper;_spawn()wraps.cmd/.batundersys.platform == "win32".agent/lsp/install.py:_native_binary_candidates()+ Windows-aware_existing_binary(); reused for npm/pip/go install probes.agent/lsp/cli.py:hermes lsp which+ bash-language-server warning now go through_existing_binary().tests/agent/lsp/test_install_and_lint_fixes.py: regression tests for staged.cmdwrappers and pipScripts/*.exelinking.scripts/release.py: AUTHOR_MAP entry for @tuancookiez-hub.Validation
WinError 193cmd.exe /c.exe/ posix commandtests/agent/lsp/Closes #34864. Supersedes #34865 and #29310 (contributor authorship preserved per-commit via rebase merge).
Infographic