Inside of Docker the output terminal will sometimes report a terminal
with zero columns when attempting to get terminal info for standard out
and then will resize the terminal triggering a SIGWINCH. The return
value check was incorrect as it never casted the return value and the
if statement functionally didn't do anything even if it was correct.
As the intention is to determine if the terminal is a TTY, this function
now returns a boolean that indicates if the ioctl() call succeeded or
not rather than checking the number of columns to see if the output is a
terminal (as it can be zero and resized).
Inside of Docker the output terminal will sometimes report a terminal with zero columns when attempting to get terminal info for standard out and then will resize the terminal triggering a SIGWINCH. The return value check was incorrect as it never casted the return value and the if statement functionally didn't do anything even if it was correct.
As the intention is to determine if the terminal is a TTY, this function now returns a boolean that indicates if the
ioctl()
call succeeded or not rather than checking the number of columns to see if the output is a terminal (as it can be zero and resized).