koush/Superuser — pull request #181 by tan-ce (2013-08-30 03:06:06+00:00)
Title: Better terminal support in Superuser for interactive sessions

Changed the way the daemon and client handles interactive (ie. standard I/O attached to a termnal emulator) sessions.

Main change is that for interactive sessions, the client opens the pts device and passes the slave device path to the daemon, then the daemon opens and dups the slave device.

The client also puts stdin into raw mode, removing buffering and therefore allowing ncurses apps to function as expected.

Finally, the client also waits for SIGWINCH and forwards the terminal window size every time the signal is received.

The changes are fairly extensive because setting up the slave terminal to be the child's controlling TTY correctly has a slightly different flow from using pipes to wrap the child's standard I/O.