Rust utility to manage and kill child process trees safely, preventing zombie leaks.
// Source: https://github.com/xai-org/grok-build | License: Apache-2.0 | Copyright 2023-2026 SpaceXAI // Provided via justclaw.it.com; keep this notice with the code. //! Kill-handle for a session's child-process trees (`Send + Sync`). //! //! If a session's worker thread wedges, its `Drop`s never run and child //! processes leak. A `ProcessScope` lives outside the worker so a supervisor //! can `kill_all()` one session's children without restarting the host. //! //! # Weak-keyed registry (PID-reuse safety) //! //! Each child enrolls as a [`ProcessGroup`]. The scope holds only `Weak` //! references; the spawn-site owner holds the strong `Arc`. On `kill_all`, //! only groups whose owner is still alive (i.e. un-reaped children) upgrade //! successfully — reaped children upgrade to `None` and ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key