Preserve spaces in quoted args

This makes SDK mode work since the model gets the complete quoted prompt passed in (instead of just the first word)
This commit is contained in:
Stefan Schoeffmann
2025-08-05 21:34:19 +02:00
parent 75ab74957d
commit 91e9d43abd

View File

@@ -31,7 +31,12 @@ export async function executeCodeCommand(args: string[] = []) {
// Execute claude command
const claudePath = process.env.CLAUDE_PATH || "claude";
const claudeProcess = spawn(claudePath, args, {
// Properly join arguments to preserve spaces in quotes
// Wrap each argument in double quotes to preserve single and double quotes inside arguments
const joinedArgs = args.length > 0 ? args.map(arg => `"${arg.replace(/\"/g, '\\"')}"`).join(" ") : "";
const claudeProcess = spawn(claudePath + (joinedArgs ? ` ${joinedArgs}` : ""), [], {
env,
stdio: "inherit",
shell: true,