* Only colorise if we are attached to a terminal.
This commit is contained in:
parent
b87b9c0d1f
commit
cec2be64f3
1 changed files with 3 additions and 0 deletions
|
@ -13,6 +13,8 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
srcNixExprDrvs,
|
srcNixExprDrvs,
|
||||||
|
@ -711,6 +713,7 @@ static VersionDiff compareVersionAgainstSet(
|
||||||
|
|
||||||
static string colorString(const string & s)
|
static string colorString(const string & s)
|
||||||
{
|
{
|
||||||
|
if (!isatty(STDOUT_FILENO)) return s;
|
||||||
return "\e[1;31m" + s + "\e[0m";
|
return "\e[1;31m" + s + "\e[0m";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue