We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dddff2b commit 9e38ab5Copy full SHA for 9e38ab5
src/mcp/client/stdio/win32.py
@@ -78,6 +78,18 @@ async def __aexit__(
78
"""Terminate and wait on process exit inside a thread."""
79
self.popen.terminate()
80
await to_thread.run_sync(self.popen.wait)
81
+
82
+ # Close the file handles to prevent ResourceWarning
83
+ if self.stdin:
84
+ await self.stdin.aclose()
85
+ if self.stdout:
86
+ await self.stdout.aclose()
87
+ if self.stdin_raw:
88
+ self.stdin_raw.close()
89
+ if self.stdout_raw:
90
+ self.stdout_raw.close()
91
+ if self.stderr:
92
+ self.stderr.close()
93
94
async def wait(self):
95
"""Async wait for process completion."""
0 commit comments