cheggaaa/pb — pull request #27 by dominikh (2014-11-02 19:35:06+00:00)
Title: make sure /dev/tty file handle stays open

*os.File has a finalizer which will close the file when the *os.File
gets garbage collected. Because tty is only live for the duration of
init, it will eventually get collected, and ttyFd will contain a bad
file descriptor, causing the ioctl in terminalWidth to fail.

Instead, make tty a global variable, holding either our /dev/tty file or
os.Stdin (there should be no need for using syscall.Stdin.)