From 8db04a19960e8748f1a620b40dd1be8914e56c23 Mon Sep 17 00:00:00 2001 From: Mordris <118046112+Mordris@users.noreply.github.com> Date: Mon, 6 Jul 2026 15:22:43 +0300 Subject: [PATCH] fix(server): preserve Windows path backslashes when parsing stdio args shell-quote treats `\` as its escape character, so parsing the args string on Windows stripped every backslash from paths like C:\Users\name\app.jar and the resulting file could not be found. Parse with cmd.exe's escape character `^` on win32 instead. Other platforms are unchanged. Fixes #853 --- server/src/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/index.ts b/server/src/index.ts index bdfe49019..82158ba73 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -436,7 +436,14 @@ const createTransport = async ( if (transportType === "stdio") { const command = (query.command as string).trim(); - const origArgs = shellParseArgs(query.args as string) as string[]; + // shell-quote's default escape character `\` strips backslashes from Windows + // paths (C:\Users\app.jar -> C:Usersapp.jar), so on Windows parse with + // cmd.exe's escape character `^` instead. + const origArgs = shellParseArgs( + query.args as string, + undefined, + process.platform === "win32" ? { escape: "^" } : undefined, + ) as string[]; const queryEnv = query.env ? JSON.parse(query.env as string) : {}; const env = { ...defaultEnvironment, ...process.env, ...queryEnv };