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.