Function posish::io::dup2 [−][src]
pub fn dup2<Fd: AsFd, NewFd: IntoFd>(fd: &Fd, new: NewFd) -> Result<OwnedFd>
Expand description
dup2(fd, new)
—Creates a new OwnedFd
instance that shares the
same underlying file description as the existing OwnedFd
instance,
closing new
and reusing its file descriptor.
Note that this function does not set the O_CLOEXEC
flag. To do a dup2
that does set O_CLOEXEC
, use dup2_with
with DupFlags::CLOEXEC
on
platforms which support it.