[erlang-questions] isatty/1 [erlang/otp#480]
Mon Oct 20 08:30:53 CEST 2014
(1) Consider an alternative.
Write your ANSI escape sequences always.
Write a separate program that either strips them out or
converts the file to HTML, so that it can be viewed in
a browser with the intended colours.
(2) Sometimes output is going BOTH to a file AND to a terminal,
using for example tee(1) or script(1), and it is not your
program that controls this.
(3) Windows claims (or claimed) to have a POSIX interface.
isatty(3) is a POSIX function. Therefore isatty(3) has
*some* relevance. There does not appear to be any reason
why a modern Windows program cannot write to a COM port.
What happens when you Telnet/SSH to/from a Windows box?
The rough equivalent of ioctl() in Windows seems to be
but I've never used it for anything, so don't really know.
(4) OpenSolaris implemented 'isatty' by testing
ioctl(f, TCGETA, &tty) >= 0.
More information about the erlang-questions