orchardup/fig — pull request #263 by d11wtq (2014-06-21 08:10:20+00:00)
Title: Handle WINCH to set the pseudo-tty size (fixes #97).

This fixes #97 and #253.

The TTY needs to be resized when the container first starts, and then on each WINCH signal received by the real TTY. I have no idea how to unit test this in practice, but it does work.

This solution uses a forked child to handle the signals, since without it, the signals were just being queued on the main process and then run once the container had exited. I'm not sure if that is an issue with the threading in SocketClient (threads and POSIX signals doesn't play well together sometimes), or if it's due to the way the SocketClient works. Forking is a good POSIX solution anyway and from reading up on Pseudo-TTYs, it's a common approach to use multi-processes.