Expand description
--capture mode: replace each child’s stdout with a piped handle, buffer
to completion, emit captured chunks in argv order after all children exit
(FR-017 + AD-007).
Without --capture (the default), children inherit the parent’s stdout
and their outputs interleave nondeterministically. With --capture, the
parent guarantees argv-ordered emission — useful for tests and scripts
that need reproducible output (US5).
Clarification Q2 + Q6 from spec.md:
- Q2: at spawn time, each child’s stdout is replaced with
Stdio::piped(). - Q6: empty-stdout children emit nothing (no separator inserted).
Functions§
- run_
with_ capture - Drive the fan-out + capture: feed reader to every child’s stdin, then read
every child’s stdout into a per-argv-position buffer, then wait + collect
statuses, then emit captured bytes in argv order to
out. - spawn_
all_ piped - Spawn all commands with piped stdout (for capture mode). Returns the spawned children in argv order. On any spawn failure, kills already-spawned children and returns the io error.