nix::unistd

Function dup2

source
pub fn dup2(oldfd: RawFd, newfd: RawFd) -> Result<RawFd>
Expand description

Create a copy of the specified file descriptor using the specified fd (see dup(2)).

This function behaves similar to dup() except that it will try to use the specified fd instead of allocating a new one. See the man pages for more detail on the exact behavior of this function.