mirror of
https://github.com/anthropics/claude-agent-sdk-python.git
synced 2025-10-06 01:00:03 +03: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:
committed by
GitHub
parent
ea7e86714f
commit
9a64bc3a64
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user