std.ps.dup2

std.ps

dup2(oldfd, newfd) -> fd

Duplicate a file descriptor to a specific number

Duplicates a file descriptor to a specific number. If newfd is already open, it is closed first. Returns the new file descriptor.