Check whether stdout is a TTY before doing colored output

Issue #396 resolved
Anonymous created an issue

Version 5.18 introduced colored output with an explicit option do disable it.

When processing monit's output with a script this means you have the escape sequences mangled in the output if not using the -B option. But this option does not exist in versions < 5.18.

How about using isatty(STDOUT_FILENO) to check whether the output is actually written to a TTY, just like ls for example.

Comments (1)

  1. Log in to comment