]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
teeboth: Colorize output only for interactive jobs
authorKacper Kornet <draenog@pld-linux.org>
Wed, 8 May 2013 21:03:04 +0000 (22:03 +0100)
committerKacper Kornet <draenog@pld-linux.org>
Wed, 8 May 2013 22:16:38 +0000 (23:16 +0100)
teeboth

diff --git a/teeboth b/teeboth
index 6c0f53372ba323045678637f2917677ade8bad6f..0612d642b8e67890d4c1192707657a5891f1ae90 100755 (executable)
--- a/teeboth
+++ b/teeboth
@@ -16,6 +16,7 @@ open my $fout, ">>", $out or die "Can't write to $out: $!" if $out;
 my $select = IO::Select->new();
 my $alive = 1;
 my $pid;
+my $interactive = -t STDOUT;
 
 my $code;
 sub sigchld
@@ -54,7 +55,7 @@ while ( $alive ) {
        foreach my $h ( $select->can_read() ) {
                sysread $h, $_, 1024;
                print $fout $_ if $fout;
-               if ( $h == \*child_err ) {
+               if ( $h == \*child_err && $interactive ) {
                        print "\033[31m$_\033[0m";
                } else {
                        print $_;
This page took 0.036011 seconds and 4 git commands to generate.