From b1b2a2a0640585e8677943911f1b0d7036000091 Mon Sep 17 00:00:00 2001 From: dengm Date: Sun, 17 May 2026 10:56:28 +0800 Subject: [PATCH] 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 --- src/mcp/mcp-client.ts | 4 +++- src/updateCheck.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mcp/mcp-client.ts b/src/mcp/mcp-client.ts index 9636732..1210313 100644 --- a/src/mcp/mcp-client.ts +++ b/src/mcp/mcp-client.ts @@ -131,7 +131,9 @@ export class McpClient { // On Windows, shell: true lets cmd.exe resolve the command via // PATHEXT (npx → npx.cmd, etc.) without blindly appending .cmd, // which would break absolute paths like process.execPath. - this.process = spawn(this.command, args, { + // Join command+args into a single string to avoid Node.js DEP0190 + // deprecation warning (passing args array with shell:true). + this.process = spawn([this.command, ...args].join(" "), [], { stdio: ["pipe", "pipe", "pipe"], env: childEnv, shell: true, diff --git a/src/updateCheck.ts b/src/updateCheck.ts index 626e529..8e378b1 100644 --- a/src/updateCheck.ts +++ b/src/updateCheck.ts @@ -161,7 +161,7 @@ async function promptUpdateChoice({ async function runNpmInstallGlobal(installSpec: string): Promise { return new Promise((resolve) => { - const child = spawn("npm", ["install", "-g", installSpec], { + const child = spawn(["npm", "install", "-g", installSpec].join(" "), [], { stdio: "inherit", shell: process.platform === "win32", }); @@ -205,7 +205,7 @@ function runNpmViewLatestVersion( if (registry) { args.push("--registry", registry); } - const child = spawn("npm", args, { + const child = spawn(["npm", ...args].join(" "), [], { stdio: ["ignore", "pipe", "pipe"], shell: process.platform === "win32", });