os.forkpty()

os.forkpty() -> (pid, master_fd)

Fork a new process with a new pseudo-terminal as controlling tty.

Like fork(), return 0 as pid to child process, and PID of child to parent. To both, return fd of newly opened pseudo-terminal.