pub async fn wait_all(
processes: &mut [&mut RunningProcess],
) -> Result<Vec<Outcome>>Expand description
Wait for all of several running processes to exit, returning their
Outcomes in the same order as processes. The processes are only
borrowed and stay usable afterwards (the exit status tokio caches remains
re-readable).
Same two non-features as wait_any: no per-process
timeout (bound the whole batch with
tokio::time::timeout) and no output pumping (a contender that fills
its stdout/stderr pipe blocks forever — drain chatty children first). Unlike
wait_any, an empty slice resolves immediately to an empty Vec: collecting
zero outcomes is well-defined, where racing none is not.
If a contender fails to reap (an OS I/O error), that Err is returned and
the remaining processes stay waitable (cancel-safe). A contender’s
Error::Cancelled (cancelled run) or Error::Stdin (a non-broken-pipe
stdin-source failure on its otherwise-successful exit) likewise short-circuits
the join — like the bulk verbs, these surface as an Err, not an Outcome.