I wrote up an RFC to add the necessary APIs to allow redirecting stdin/out/err of subprocesses spawned via
Command to arbitrary open file handles. Right now its possible to make the child process use the parent’s stdio, send it to
/dev/null, or pipe them back to the parent. The changes proposed in the RFC would allow child processes to use opened
Files as stdio, as well as allow for piping data directly between two child processes.
The challenge for designing the API largely comes down to balancing unsafety while remaining backwards compatible with the stabilized
@alexcrichton and @aturon have proposed an even simpler solution which would not requier introducing a new API, however, I feel like a public API will become necessary in the future so we might as well consider one right now.
I’d appreciate any additional feedback on what others may think! (Please post comments on the RFC!)