pub fn stream_with<E>(
command: &mut Command,
token: &CancelToken,
policy: &StreamPolicy,
consume: impl FnMut(&[u8]) -> Result<(), E>,
) -> Result<StreamOutput, StreamError<E>>Expand description
Run one command to completion while its stdout streams through
consume. Supervision is identical to capture_with: own process
group, cancellation SIGKILLs it, the deadline kills it, stderr is
drained concurrently with bounded retention, stdin is /dev/null.
Stdout is never retained — a bounded number of chunks is in flight
between the reader thread and consume, so memory stays bounded by
what the consumer keeps. A consumer error kills the child and
surfaces as StreamError::Consumer.