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.
§Errors
A contender’s Error::Io (a failed reap), Error::Cancelled (a
cancelled run), or Error::Stdin (a non-broken-pipe stdin-source failure
on its otherwise-successful exit) short-circuits the join; the remaining
processes stay waitable (cancel-safe). A non-zero exit or signal is returned
as an Outcome, not an error. An empty slice resolves to an empty Vec.
§Panics
Does not panic on any caller input: the final collection step carries an
internal consistency assertion (every outcome slot is filled once all
contenders have exited, an invariant the join loop maintains). It is
documented only because that assertion is a hard expect.