mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-12-23 09:19:52 +00:00
fix: propagate user cwd to subprocess environment (#136)
The subprocess transport was ignoring user-specified cwd from ClaudeCodeOptions, causing the working directory preference to be overridden by os.environ. This fix ensures the CWD environment variable is properly passed to child processes. - Add PWD env var when self._cwd is set in SubprocessCLITransport - Fixes issue where custom working directory was not respected - Maintains backward compatibility Tests: All existing tests pass
This commit is contained in:
parent
ea7e86714f
commit
9a64bc3a64
1 changed files with 3 additions and 0 deletions
|
|
@ -182,6 +182,9 @@ class SubprocessCLITransport(Transport):
|
|||
"CLAUDE_CODE_ENTRYPOINT": "sdk-py",
|
||||
}
|
||||
|
||||
if self._cwd:
|
||||
process_env["PWD"] = self._cwd
|
||||
|
||||
self._process = await anyio.open_process(
|
||||
cmd,
|
||||
stdin=PIPE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue