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)
| 223 | |
| 224 | |
| 225 | def 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 | |
| 240 | async def terminate_windows_process_tree(process: Process | FallbackProcess) -> None: |
no test coverage detected