diff --git a/src/main/cli.ts b/src/main/cli.ts index 7a0fbd3..9507874 100644 --- a/src/main/cli.ts +++ b/src/main/cli.ts @@ -67,7 +67,8 @@ async function main(): Promise { const launch = profileLaunchSpawnCommand(plan); const child = spawn(launch.command, launch.args, { env: childEnv, - stdio: "inherit" + stdio: "inherit", + windowsVerbatimArguments: !!launch.windowsVerbatimArguments }); const code = await waitForChild(child); process.exitCode = code; diff --git a/src/main/profile-launch-core.ts b/src/main/profile-launch-core.ts index b1135dd..b2d2139 100644 --- a/src/main/profile-launch-core.ts +++ b/src/main/profile-launch-core.ts @@ -13,6 +13,7 @@ export type ProfileLaunchPlan = { export type ProfileLaunchSpawnCommand = { args: string[]; command: string; + windowsVerbatimArguments?: boolean; }; export function findProfileForOpen(config: Pick, profileRef: string): ProfileConfig { @@ -98,15 +99,14 @@ export function profileLaunchSpawnCommand(plan: Pick 0) { + cmdLine += " " + plan.args.join(" "); + } return { - args: [ - "/d", - "/s", - "/v:off", - "/c", - windowsCommandScriptInvocation(plan.command, plan.args) - ], - command: process.env.ComSpec || process.env.COMSPEC || "cmd.exe" + args: ["/d", "/v:off", "/c", cmdLine], + command: process.env.ComSpec || process.env.COMSPEC || "cmd.exe", + windowsVerbatimArguments: true }; } diff --git a/src/main/profile-service.ts b/src/main/profile-service.ts index aa35601..68b5888 100644 --- a/src/main/profile-service.ts +++ b/src/main/profile-service.ts @@ -77,7 +77,7 @@ function applyClaudeCodeProfile(config: AppConfig, profile: ProfileConfig, token const wrapperResult = writeClaudeCodeWrapper(config, profile); const nextSettings = { ...settings, - apiKeyHelper: helperResult.file, + apiKeyHelper: process.platform === "win32" ? `"${helperResult.file}"` : helperResult.file, env }; const writeResult = writeFileWithBackup(settingsFile, `${JSON.stringify(nextSettings, null, 2)}\n`, { mode: privateFileMode });