Description
As it is, due to a comedy of errors, code like Command::new("head").arg("-c").arg("100000000").arg("/dev/zero").output()
is accidentally quadratic if rust reads fast enough to drain the stdout pipe, while
Command::new("head").arg("-c").arg("100000000").arg("/dev/zero").stderr(Stdio::null()).output()
is fine.
Since the first command has to listen to both stdout and stderr, it calls read2 and winds up looping around pipe + read_to_end, and each read_to_end call reinitializes the buffer again and again. An override of initializer() would skip this, or I suppose there could be some extra special casing so that the read_to_end state isn't lost during poll, but that seems like more work.
I think windows avoids this entirely, but the commented-out select-based read2 impl in redox would also want this for redox's FileDesc.