MCPcopy
hub / github.com/modelcontextprotocol/python-sdk / close_process_job

Function close_process_job

src/mcp/os/win32/utilities.py:225–237  ·  view source on GitHub ↗

Closes the process's Job Object handle, if it still has one. KILL_ON_JOB_CLOSE makes the close also kill any members still alive, deterministically rather than at GC time; a deliberate divergence from POSIX, where a graceful server's children are left alive.

(process: Process | FallbackProcess)

Source from the content-addressed store, hash-verified

223
224
225def close_process_job(process: Process | FallbackProcess) -> None:
226 """Closes the process's Job Object handle, if it still has one.
227
228 KILL_ON_JOB_CLOSE makes the close also kill any members still alive,
229 deterministically rather than at GC time; a deliberate divergence from
230 POSIX, where a graceful server's children are left alive.
231 """
232 if sys.platform != "win32":
233 return
234
235 job = _process_jobs.pop(process, None)
236 if job is not None:
237 _close_job_handle(job)
238
239
240async def terminate_windows_process_tree(process: Process | FallbackProcess) -> None:

Callers 1

_stop_server_processFunction · 0.90

Calls 1

_close_job_handleFunction · 0.85

Tested by

no test coverage detected