mirror of
https://github.com/musistudio/claude-code-router.git
synced 2026-01-30 06:12:06 +00:00
Merge pull request #449 from schoeffm/bugfix/fix-code-args-handling
Preserve spaces in quoted args
This commit is contained in:
@@ -40,12 +40,16 @@ export async function executeCodeCommand(args: string[] = []) {
|
||||
// Execute claude command
|
||||
const claudePath = process.env.CLAUDE_PATH || "claude";
|
||||
|
||||
// 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(" ") : "";
|
||||
|
||||
// 🔥 CONFIG-DRIVEN: stdio configuration based on environment
|
||||
const stdioConfig: StdioOptions = config.NON_INTERACTIVE_MODE
|
||||
? ["pipe", "inherit", "inherit"] // Pipe stdin for non-interactive
|
||||
: "inherit"; // Default inherited behavior
|
||||
|
||||
const claudeProcess = spawn(claudePath, args, {
|
||||
const claudeProcess = spawn(claudePath + (joinedArgs ? ` ${joinedArgs}` : ""), [], {
|
||||
env,
|
||||
stdio: stdioConfig,
|
||||
shell: true,
|
||||
|
||||
Reference in New Issue
Block a user