Skip to content

Commit b1b2a2a

Browse files
fix: resolve DEP0190 deprecation warning on Windows
Join command+args into a single string before passing to spawn with shell: true to avoid Node.js DEP0190 warning on Windows. Affected calls: - McpClient.connect() in mcp-client.ts - runNpmInstallGlobal() in updateCheck.ts - npmViewVersion() in updateCheck.ts
1 parent 38fc201 commit b1b2a2a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/mcp/mcp-client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ export class McpClient {
131131
// On Windows, shell: true lets cmd.exe resolve the command via
132132
// PATHEXT (npx → npx.cmd, etc.) without blindly appending .cmd,
133133
// which would break absolute paths like process.execPath.
134-
this.process = spawn(this.command, args, {
134+
// Join command+args into a single string to avoid Node.js DEP0190
135+
// deprecation warning (passing args array with shell:true).
136+
this.process = spawn([this.command, ...args].join(" "), [], {
135137
stdio: ["pipe", "pipe", "pipe"],
136138
env: childEnv,
137139
shell: true,

src/updateCheck.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async function promptUpdateChoice({
161161

162162
async function runNpmInstallGlobal(installSpec: string): Promise<boolean> {
163163
return new Promise((resolve) => {
164-
const child = spawn("npm", ["install", "-g", installSpec], {
164+
const child = spawn(["npm", "install", "-g", installSpec].join(" "), [], {
165165
stdio: "inherit",
166166
shell: process.platform === "win32",
167167
});
@@ -205,7 +205,7 @@ function runNpmViewLatestVersion(
205205
if (registry) {
206206
args.push("--registry", registry);
207207
}
208-
const child = spawn("npm", args, {
208+
const child = spawn(["npm", ...args].join(" "), [], {
209209
stdio: ["ignore", "pipe", "pipe"],
210210
shell: process.platform === "win32",
211211
});

0 commit comments

Comments
 (0)