dup2

Function dup2 

Source
pub unsafe fn dup2(old_fd: &impl AsRawFd, new_fd: &impl AsRawFd) -> Result<()>
Expand description

Duplicates the file descriptor old_fd to the new one new_fd.

ยงSafety

Make sure that new_fd is not the same as an FD that is already being used by the program.