Fix shell quoting for exec command arguments
Arguments with special characters (e.g. JSON strings) were passed
unquoted, causing breakage for commands like:
--speculative-config '{"method":"qwen3_next_mtp","num_speculative_tokens":2}'
Use printf %q in launch-cluster.sh and shlex.quote() in run-recipe.py
to properly escape arguments.
This commit is contained in:
@@ -115,7 +115,7 @@ while [[ "$#" -gt 0 ]]; do
|
|||||||
fi
|
fi
|
||||||
ACTION="exec"
|
ACTION="exec"
|
||||||
shift
|
shift
|
||||||
COMMAND_TO_RUN="$@"
|
COMMAND_TO_RUN=$(printf "%q " "$@")
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ RELATED FILES:
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -473,7 +474,7 @@ def generate_launch_script(recipe: dict[str, Any], overrides: dict[str, Any], is
|
|||||||
# Append extra args if provided (after --)
|
# Append extra args if provided (after --)
|
||||||
if extra_args:
|
if extra_args:
|
||||||
# Join extra args and append to command
|
# Join extra args and append to command
|
||||||
extra_args_str = ' '.join(extra_args)
|
extra_args_str = ' '.join(shlex.quote(a) for a in extra_args)
|
||||||
command = command.rstrip()
|
command = command.rstrip()
|
||||||
# Handle multi-line commands with backslash continuations
|
# Handle multi-line commands with backslash continuations
|
||||||
if command.endswith('\\'):
|
if command.endswith('\\'):
|
||||||
|
|||||||
Reference in New Issue
Block a user