Skip to main content

contained_output_until

Function contained_output_until 

Source
pub async fn contained_output_until(
    cmd: &mut Command,
    stop: impl Future<Output = ()>,
) -> Result<ContainedOutput>
Expand description

contained_output, plus a stop future (a deadline, a cancel token). When stop fires first the tree is killed and the output written so far is still returned, so a hung command leaves evidence of where it hung.

A command that exits on its own is released, not killed: whatever it deliberately left running with its output redirected (nohup server >log &) keeps running, as it did with a bare output(). Only a dropped future or stop kills the tree. Until then the group is also listed for kill_contained_trees_for_exit, because a terminating signal ends Codewhale through process::exit, where no destructor runs, and a child in its own process group no longer receives the terminal’s Ctrl+C itself.