fix(windows): quote command paths with spaces when spawning with shell

shell: true passes commands to cmd.exe /d /s /c which strips outer
quotes, causing paths like C:\Program Files\... to split at the space.
This commit is contained in:
Mohamed Boudra
2026-04-01 23:58:00 +07:00
parent a4326ec5c0
commit 9dc3d116b4
7 changed files with 69 additions and 7 deletions
+7 -2
View File
@@ -1,7 +1,12 @@
import type { Command } from "commander";
import { execFileSync } from "node:child_process";
import { createRequire } from "node:module";
import { getOrCreateServerId, findExecutable, applyProviderEnv } from "@getpaseo/server";
import {
getOrCreateServerId,
findExecutable,
quoteWindowsCommand,
applyProviderEnv,
} from "@getpaseo/server";
import { tryConnectToDaemon } from "../../utils/client.js";
import type { CommandOptions, ListResult, OutputSchema } from "../../output/index.js";
import { resolveLocalDaemonState, resolveTcpHostFromListen } from "./local-daemon.js";
@@ -170,7 +175,7 @@ function checkProviderBinary(binary: string): { path: string | null; version: st
}
const env = applyProviderEnv(process.env);
try {
const output = execFileSync(binaryPath, ["--version"], {
const output = execFileSync(quoteWindowsCommand(binaryPath), ["--version"], {
encoding: "utf8",
timeout: 5000,
stdio: ["ignore", "pipe", "pipe"],