std.ps.pty_open

std.ps

pty_open() -> pty

Open a new pseudoterminal pair

Opens a new pseudoterminal (PTY) master/slave pair. Returns a table with master, the master's file descriptor, and slave, the slave's path. The caller opens the slave path, usually in a child that makes it its controlling terminal.

The master is close-on-exec. A forked child keeps it; a program the caller execs does not. A dup2 onto stdio clears the flag on the copy.