utilities
POSIX-specific functionality for stdio transport operations.
same_open_file
Whether two descriptors refer to the same open file.
False on Windows - anonymous pipe handles carry no identity to compare - and False when either descriptor cannot be interrogated.
Source code in src/mcp/os/posix/utilities.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
terminate_posix_process_tree
async
terminate_posix_process_tree(
process: Process, timeout_seconds: float = 2.0
) -> None
Terminates a process and all its descendants on POSIX.
SIGTERMs the process group, waits up to timeout_seconds for it to disappear, then SIGKILLs whatever remains. killpg reaches every descendant atomically, even ones whose parent already exited; daemonizers that left the group escape by design. A group only disappears once every member is dead and reaped, so a client running as PID 1 should reap orphans (e.g. docker run --init) or the wait below runs its full timeout.
Source code in src/mcp/os/posix/utilities.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |