ptyrun — wrap a pty around a program


ptyrun {subprogram} {args...}


ptyrun obtains a new pty and runs subprogram under it, transparently forwarding input and output. ptyrun initializes the pty to sane mode.

Descriptors 0, 1, and 2 of subprogram are redirected to the pty; its controlling terminal is set to the pty; descriptor 3 is redirected to /dev/tty; environment variable TTY gives the name of the pty.

When subprogram exits, ptyrun exits with the same exit code. If subprogram stops, ptyrun immediately sends SIGCONT to subprogram's process group.

ptyrun is a synonym for ptyget ptyio ptyspawn. ptyspawn(1) options may be used with ptyrun.


ptyrun was originally part of Daniel J. Bernstein's ptyget toolset in 1996.


Original code and documentation by Daniel J. Bernstein. Documentation modernizations by Jonathan de Boyne Pollard.