implement TryFrom so that std::process:ChildStdxx can be converted to tokio::process:ChildStdxx #2837
Labels
A-tokio
Area: The main tokio crate
C-feature-request
Category: A feature request.
M-process
Module: tokio/process
Is your feature request related to a problem? Please describe.
Both
std
andtokio
haveStdin
/Stdout
/Stderr
type, IMOtokio
ones are more powerful because they implementsAsyncRead
.In tokio/src/process/unix/mod.rs, tokio's
Stdxx
are wrappers aroundstd::process::Stdxx
:So it should be really easy to add
impl TryFrom<std::process::ChildStdin> for ChildStdin
for example, not to mention tokio has function likefn stdio<T>(option: Option<T>) -> io::Result<Option<PollEvented<Fd<T>>>>
.Describe the solution you'd like
Add
impl
From
orTryFrom
so that it is possible to convertstd::process::Stdxx
intotokio::process::Stdxx
.Additional context
Right now it is impossible (from external API) to construct
tokio::process::Stdxx
withoutexecve
(viaCommand
). it would be valuable to construct them withnix::unistd::fork
. Sincestd::process::Stdxx
is just a thin-wrapper aroundFileDesc
, thanks to rust's zero cost abstraction, they're identical toc_int
(32-bit, or HANDLE/64-bit on Windows). But this is not true fortokio::process::Stdxx
, if we can convertstd::process::Stdxx
intotokio::process::Stdxx
, then we can do IO redirections withunistd::fork
.The text was updated successfully, but these errors were encountered: