Expand description
Shared subprocess handler for shell tools.
Responsibilities:
- Spawn the given program + args with piped stdout/stderr, null stdin.
- Concurrently drain stdout and stderr into byte buffers, each capped at its respective byte budget. Continue reading past the cap until EOF so the child doesn’t block on full pipe buffers; bytes past the cap are discarded.
- Wait for the child with an optional absolute deadline. On timeout: Unix: SIGTERM, then sleep grace_ms, then Child::kill (SIGKILL). Windows: Child::kill directly.
- UTF-8-lossy decode both streams; return exit code + truncation flags + duration.