FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

refactor: rename DummyProcess to FallbackProcess in Windows stdio by felixweinberger · Pull Request #1015 · modelcontextprotocol/python-sdk · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 6 additions & 6 deletions src/mcp/client/stdio/win32.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.

Expand Down

Back | FazBrowse Home | New Git URL