fix: use shell: true for LSP spawn on Windows to resolve .cmd executables (#1233)

On Windows, executables like npx, tsc, and typescript-language-server
are .cmd batch scripts. Node.js's spawn() can't find them without
shell: true because it looks for exact binary names, not .cmd wrappers.
This caused ENOENT crashes during auto-mode when the LSP tried to
spawn npx tsc --noEmit for TypeScript diagnostics.

Added shell: true conditional on process.platform === 'win32' in the
LSP client's spawn call. Unix platforms are unaffected.

Fixes #1222
This commit is contained in:
Tom Boucher 2026-03-18 15:55:23 -04:00 committed by GitHub
parent 11d962abb4
commit ebe59a987f

View file

@ -455,6 +455,9 @@ async function getOrCreateClientOnce(config: ServerConfig, cwd: string, initTime
cwd,
stdio: ["pipe", "pipe", "pipe"],
env: env ? { ...process.env, ...env } : undefined,
// On Windows, executables like npx/tsc are .cmd scripts that need
// shell resolution. Without this, spawn fails with ENOENT (#1222).
shell: process.platform === "win32",
});
// Handle spawn failure (e.g., ENOENT when the command doesn't exist).