I'd like to capture stdout/stderr of a subprocess but also stream the outputs to my process' stdout/stderr as well. In bash I'd do something like:
my_command > >(tee /tmp/capture.out) 2> >(tee /tmp/capture.err >&2)
Is there any reasonably concise or typical way to do this in Rust? Looking at std::process::Child.wait_with_output() and sys::pipe::read2 handling stdout/stderr directly seems somewhat involved (and involves an unsafe call to poll).
Another way of framing the question might be "what's the expected way to stream over a subprocess' stdout and stderr?" which would at least allow me to manually capture and print the streams' contents.
I'm currently using std::process but if it's easier with the subprocess crate I'd be willing to swap to that.