fn read_capped(reader: impl Read, cap: Option<usize>) -> Vec<u8> ⓘExpand description
Read reader to EOF, retaining at most cap bytes when Some.
With None this is a plain read_to_end. With Some(cap) it still
drains the pipe to EOF — so the child never blocks on a full pipe, which
would turn a chatty-but-brief command into a spurious timeout — but
discards everything past cap so a command that floods its output can’t
balloon memory before the caller truncates it (#213).