Skip to content

Commit a179ccc

Browse files
committed
readd aclose
1 parent 25498aa commit a179ccc

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/mcp/client/stdio/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ async def stdin_writer():
191191
except ProcessLookupError:
192192
# Process already exited, which is fine
193193
pass
194-
await read_stream_writer.aclose()
195-
await write_stream_reader.aclose()
196194
await read_stream.aclose()
197195
await write_stream.aclose()
196+
await read_stream_writer.aclose()
197+
await write_stream_reader.aclose()
198198

199199

200200
def _get_executable_command(command: str) -> str:

tests/client/test_stdio.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async def test_stdio_client_universal_cleanup():
118118
"""
119119
import time
120120
import sys
121-
121+
122122
# Simulate a long-running process
123123
for i in range(100):
124124
time.sleep(0.1)
@@ -532,7 +532,7 @@ async def test_stdio_client_graceful_stdin_exit():
532532
script_content = textwrap.dedent(
533533
"""
534534
import sys
535-
535+
536536
# Read from stdin until it's closed
537537
try:
538538
while True:
@@ -541,7 +541,7 @@ async def test_stdio_client_graceful_stdin_exit():
541541
break
542542
except:
543543
pass
544-
544+
545545
# Exit gracefully
546546
sys.exit(0)
547547
"""
@@ -590,16 +590,16 @@ async def test_stdio_client_stdin_close_ignored():
590590
import signal
591591
import sys
592592
import time
593-
593+
594594
# Set up SIGTERM handler to exit cleanly
595595
def sigterm_handler(signum, frame):
596596
sys.exit(0)
597-
597+
598598
signal.signal(signal.SIGTERM, sigterm_handler)
599-
599+
600600
# Close stdin immediately to simulate ignoring it
601601
sys.stdin.close()
602-
602+
603603
# Keep running until SIGTERM
604604
while True:
605605
time.sleep(0.1)

0 commit comments

Comments
 (0)