I’m writing my own ExUnit formatter, and its dependent on knowing the terminal width to properly output its results.
I make a call to the Erlang io:columns/0 function in the init of my formatter. Instead of giving me a tuple of {:ok, <termwidth>}, I get {:error, :enotsup}. Erlang docs indicate that this is because I’m trying to read the terminal width of a non-tty.
Question is, how can I get the termwidth of the current TTY outputting the results of my ExUnit test run. If they are not being output to a TTY that is acceptable, I can code a fallback.
So for anyone else writing an ExUnit formatter or anything else that needs to get the column count, you have to run within IEx, or manually specify the tty device you’re targeting.