You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a Command, it is often desirable to plumb stdout to the same place as stderr, as if 2>&1 in a shell rune.
Unfortunately, there is no way to do this with Command right now without writing unsafe, non-portable code.
Really we want to fix this so that you can pass to Command anything that implements AsRawFd, so probably the right thing would be std::Process::Stdio::reuse<F:AsRawFd>(fd: &f). The implementation is not entirely trivial - we need an fd-permuting algorithm that avoids making unnecessary calls to dup2.
On Windows that would be std::Process::Stdio::reuse<F:AsRawHandle>(fd: &f) I guess.
It's a shame that we have totally separate names for *RawFd and *RawHandle rather than a portable-opaque but nonportably-transparent OsOpenFileReference type and AsOsOpenFileReference, IntoOsOpenFileReference, FromOsOpenFileReference but that seems like rather a major change.
Activity
fmease commentedon Dec 28, 2024
This was addressed in #114590. Closing as fixed.