diff --git a/src/claude_code_sdk/_internal/transport/subprocess_cli.py b/src/claude_code_sdk/_internal/transport/subprocess_cli.py index c6da949..ab7de7e 100644 --- a/src/claude_code_sdk/_internal/transport/subprocess_cli.py +++ b/src/claude_code_sdk/_internal/transport/subprocess_cli.py @@ -171,7 +171,7 @@ class SubprocessCLITransport(Transport): raise CLIConnectionError("Not connected") json_buffer = "" - + # Process stdout messages first try: async for line in self._stdout_stream: diff --git a/tests/test_fastapi_streaming_compatibility.py b/tests/test_fastapi_streaming_compatibility.py index 47a678c..20a6ad5 100644 --- a/tests/test_fastapi_streaming_compatibility.py +++ b/tests/test_fastapi_streaming_compatibility.py @@ -9,7 +9,7 @@ def test_no_task_groups_in_receive_messages(): """Verify receive_messages doesn't use task groups (fixes FastAPI issue #4).""" # Get the source code of receive_messages source = inspect.getsource(SubprocessCLITransport.receive_messages) - + # The fix: ensure no task group or task creation assert "create_task_group" not in source, ( "receive_messages must not use create_task_group to avoid " @@ -19,7 +19,7 @@ def test_no_task_groups_in_receive_messages(): "receive_messages must not create tasks to maintain " "compatibility with FastAPI's generator handling" ) - + # Verify stderr is still being read (sequential approach) assert "_stderr_stream" in source, "Should still read stderr" - assert "stderr_lines" in source, "Should collect stderr output" \ No newline at end of file + assert "stderr_lines" in source, "Should collect stderr output"