Utilities that detach subprocesses from a controlling TTY, reset OOM scores, and kill children when the parent dies. Reuse when a raw-mode TUI spawns git, npm, pagers, or other tools.
// 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. //! Lightweight process-spawning utilities for TTY safety. //! //! When a TUI/pager/raw-mode terminal owns the parent process's controlling //! TTY, every child process must be detached — otherwise it (or its //! grandchildren: npm, git, pinentry, ssh-agent …) can open `/dev/tty` //! directly and spew mouse escape codes, capability-probe replies, or //! credential prompts onto the live screen. //! //! This crate provides the minimal surface needed to make subprocess spawning //! safe. It is intentionally tiny so that **every** crate in the workspace //! can depend on it without pulling in heavyweight libraries. //! //! # Usag ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key