Skip to content

Commit 771b345

Browse files
committed
Fix JSON argument quoting to match bash implementation exactly
Resolve the quoting issue identified in comment #323 where Python generated: - "'{"kv_connector":"NixlConnector","kv_role":"kv_both"}'" (broken) Now correctly generates like bash implementation: - '{"kv_connector":"NixlConnector","kv_role":"kv_both"}' (working) - Detect arguments that already have single quotes (JSON strings) - Use them as-is without additional double quote wrapping - Only wrap regular arguments in double quotes Addresses the last outstanding reviewer concern before final approval.
1 parent 0ac9499 commit 771b345

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

setup/functions.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -964,9 +964,13 @@ def add_command_line_options(args_string):
964964
# Clean up any trailing artifacts from line continuation
965965
cleaned_arg = arg.rstrip('\\').rstrip('"').strip()
966966
if cleaned_arg:
967-
# Escape any existing quotes in the argument
968-
escaped_arg = cleaned_arg.replace('"', '\\"')
969-
yaml_list.append(f" - \"{escaped_arg}\"")
967+
# Handle JSON strings and complex arguments with proper quoting
968+
if cleaned_arg.startswith("'") and cleaned_arg.endswith("'"):
969+
# Already has single quotes - use as-is for JSON strings
970+
yaml_list.append(f" - {cleaned_arg}")
971+
else:
972+
# Regular argument - wrap in double quotes
973+
yaml_list.append(f" - \"{cleaned_arg}\"")
970974
return "\n".join(yaml_list)
971975
else:
972976
processed_args = processed_args.replace("____", " ")

0 commit comments

Comments
 (0)