From 265d7242987c69838fa746f8aa9ac4c8550681be Mon Sep 17 00:00:00 2001 From: Martin Hwasser Date: Mon, 24 Mar 2025 15:04:28 +0100 Subject: [PATCH] fix: attempt to terminate process gracefully --- src/mcp/client/stdio.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mcp/client/stdio.py b/src/mcp/client/stdio.py index df721bbc3..9e45d9ed6 100644 --- a/src/mcp/client/stdio.py +++ b/src/mcp/client/stdio.py @@ -159,4 +159,7 @@ async def stdin_writer(): ): tg.start_soon(stdout_reader) tg.start_soon(stdin_writer) - yield read_stream, write_stream + try: + yield read_stream, write_stream + finally: + process.terminate()