colorize only if run from terminal
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Feb 2012 16:06:42 +0000 (17:06 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Feb 2012 16:06:42 +0000 (17:06 +0100)
lib/WarnColor.pm

index 5cf738d..4afb940 100644 (file)
@@ -24,7 +24,7 @@ sub BEGIN {
                $msg =~ s{(["\{\}\#])}{\e[33m$1\e[0m}g; # yellow
                print STDERR $msg unless $msg =~ m{^#} && ! $ENV{DEBUG};
                return 1;
-       };
+       } if -t STDOUT; # colorize only if run from terminal !
 
 }