Skip to content

fix: close _stdout_stream in SubprocessCLITransport.close()#688

Open
possibilities wants to merge 1 commit intoanthropics:mainfrom
possibilities:fix/close-stdout-stream
Open

fix: close _stdout_stream in SubprocessCLITransport.close()#688
possibilities wants to merge 1 commit intoanthropics:mainfrom
possibilities:fix/close-stdout-stream

Conversation

@possibilities
Copy link

Summary

  • close() called .aclose() on _stdin_stream and _stderr_stream but only set _stdout_stream = None, leaking the anyio TextReceiveStream and producing ResourceWarnings
  • Added the missing .aclose() call for _stdout_stream, matching the existing pattern for the other two streams
  • Updated test_connect_close to verify all stream closures

Test plan

  • pytest tests/test_transport.py::TestSubprocessCLITransport::test_connect_close passes
  • 278/280 tests pass (2 pre-existing trio failures); excluded test_sdk_mcp_integration.py and test_tool_callbacks.py (pre-existing pytest-asyncio failures)
  • ruff check and ruff format clean
  • mypy src/ clean

close() properly closed _stdin_stream and _stderr_stream via .aclose()
but only set _stdout_stream = None without closing it, leaking anyio
TextReceiveStream objects and producing ResourceWarnings.
@subhashdasyam
Copy link

@claude

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.

2 participants