Skip to content

Conversation

@dicksontsai
Copy link
Collaborator

Summary

  • Add stderr callback option to ClaudeCodeOptions to capture CLI subprocess stderr output
  • Matches TypeScript SDK's stderr callback behavior for feature parity
  • Useful for debugging and monitoring CLI operations

Changes

  • Added stderr: Callable[[str], None] | None field to ClaudeCodeOptions
  • Updated SubprocessCLITransport to handle stderr streaming with async task
  • Added example demonstrating stderr callback usage
  • Added e2e tests to verify functionality

Test plan

  • Run e2e tests: python -m pytest e2e-tests/test_stderr_callback.py -v
  • Run example: python examples/stderr_callback_example.py
  • Verify backward compatibility with existing debug_stderr field
  • All linting and type checks pass

🤖 Generated with Claude Code

Add stderr callback option to ClaudeCodeOptions that allows capturing
stderr output from the CLI subprocess. This matches the TypeScript SDK's
behavior and is useful for debugging and monitoring CLI operations.

- Add stderr callback field to ClaudeCodeOptions
- Update SubprocessCLITransport to handle stderr streaming
- Add example showing stderr callback usage
- Add e2e tests to verify functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@dicksontsai dicksontsai merged commit 180d648 into main Sep 28, 2025
25 of 26 checks passed
@dicksontsai dicksontsai deleted the dickson/f5960b83 branch September 28, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants