Skip to content

Commit ea7e867

Browse files
authored
add end of command options to sanitize user prompt (#130)
The PR should address the issue where user prompt maybe treated as a option with leading `-` Assuming `claude` does follow POSIX standard, the `--` option should solve the issue. fixes #129
1 parent a801a33 commit ea7e867

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/claude_code_sdk/_internal/transport/subprocess_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def _build_command(self) -> list[str]:
157157
cmd.extend(["--input-format", "stream-json"])
158158
else:
159159
# String mode: use --print with the prompt
160-
cmd.extend(["--print", str(self._prompt)])
160+
cmd.extend(["--print", "--", str(self._prompt)])
161161

162162
return cmd
163163

0 commit comments

Comments
 (0)