Subject: | GetTerminalSize has bizarre failure modes |
GetTerminalSize tries to use one of GetTermSizeVIO, GetTermSizeGWINSZ, GetTermSizeGSIZE, or GetTermSizeWin32 to get the terminal size. If those don't produce any results, it will fall back to calling `resize` or `stty`.
If given a file handle other than STDOUT, using resize or stty would be entirely inappropriate. Additionally, if the file handle isn't connected to a terminal, the initial GetTerm* calls will produce no results. That is the correct value that should be returned, yet it will still fall back to `resize` or `stty`. On some systems a resize call like this will pause for 10 seconds before timing out.
I don't think this module should be falling back to `resize` or `stty` at all, but if it is going to, it should only do so if it is checking STDOUT and -t *STDOUT is true.