pub async fn wait_with_timeout(
child: &mut Child,
timeout: Duration,
) -> Result<Option<Output>>Expand description
Wait for a child, reading both pipes concurrently so a chatty command cannot deadlock by filling a pipe buffer, and killing it if the deadline passes.
wait_with_output consumes the Child, which is why the timeout path
there leaks a live process: there is nothing left to kill. Borrowing
instead keeps the handle available.