[erlang-questions] isatty/1 [erlang/otp#480]
Tue Oct 21 18:39:01 CEST 2014
On Mon, Oct 20, 2014 at 5:49 AM, Andrew Stone wrote:
> I'm very late in responding to this, as I was on vacation and then
> Tuncer, I just want to know if I'm talking to a file so I can omit
> writing escape codes with io:format when attempting to write a
> warning in red to the user. If the escape codes do get written to a
> file by automated tooling, the file it will have things like
> \e[0;31m in there, obscuring the output. It'd be better if we
> swapped that for an [Err] or just omitted it altogether in that
I'm repeating myself, but to be totally clear I'll respond anyway :).
Even though it's not as precise+reliable of a terminal capability
indicator, isatty/1 can be used for your problem, and it has other
uses as well, so I think it makes sense to include in otp.git.
Also, escripts cannot portably rely on non-otp.git native code.
More information about the erlang-questions