From d5fa7b9702319eb177257b99d61a554d0b97bea0 Mon Sep 17 00:00:00 2001 From: Felix Weinberger Date: Tue, 24 Jun 2025 15:09:08 +0100 Subject: [PATCH] refactor: rename DummyProcess to FallbackProcess More descriptive name that better reflects its purpose as a fallback implementation for Windows subprocess handling when asyncio support is unavailable. --- src/mcp/client/stdio/win32.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mcp/client/stdio/win32.py b/src/mcp/client/stdio/win32.py index 1c9b9b94c..7246b9dec 100644 --- a/src/mcp/client/stdio/win32.py +++ b/src/mcp/client/stdio/win32.py @@ -46,7 +46,7 @@ def get_windows_executable_command(command: str) -> str: return command -class DummyProcess: +class FallbackProcess: """ A fallback process wrapper for Windows to handle async I/O when using subprocess.Popen, which provides sync-only FileIO objects. @@ -115,7 +115,7 @@ async def create_windows_process( env: dict[str, str] | None = None, errlog: TextIO | None = sys.stderr, cwd: Path | str | None = None, -) -> DummyProcess: +) -> FallbackProcess: """ Creates a subprocess in a Windows-compatible way. @@ -131,7 +131,7 @@ async def create_windows_process( cwd (Path | str | None): Working directory for the subprocess Returns: - DummyProcess: Async-compatible subprocess with stdin and stdout streams + FallbackProcess: Async-compatible subprocess with stdin and stdout streams """ try: # Try launching with creationflags to avoid opening a new console window @@ -145,7 +145,7 @@ async def create_windows_process( bufsize=0, # Unbuffered output creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0), ) - return DummyProcess(popen_obj) + return FallbackProcess(popen_obj) except Exception: # If creationflags failed, fallback without them @@ -158,10 +158,10 @@ async def create_windows_process( cwd=cwd, bufsize=0, ) - return DummyProcess(popen_obj) + return FallbackProcess(popen_obj) -async def terminate_windows_process(process: Process | DummyProcess): +async def terminate_windows_process(process: Process | FallbackProcess): """ Terminate a Windows process.