pub fn dup2_with<Fd: AsFd>(fd: Fd, new: &OwnedFd, flags: DupFlags) -> Result<()>
Expand description

dup3(fd, new, flags)—Creates a new OwnedFd instance that shares the same underlying file description as the existing OwnedFd instance, closing new and reusing its file descriptor, with flags.

dup2_with is the same as dup2 but adds an additional flags operand, and fails in the case that fd and new have the same file descriptor value.

References