]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
always append; allow empty logfile (it will just colorise stderr then)
authorElan Ruusamäe <glen@delfi.ee>
Sat, 12 Jan 2013 10:27:19 +0000 (12:27 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Sat, 12 Jan 2013 10:29:05 +0000 (12:29 +0200)
teeboth

diff --git a/teeboth b/teeboth
index b30e92c01203a431c309a51c778f6ac49a4c24bb..caf4620ae6296a4af41b65b80b3e4092221a198f 100755 (executable)
--- a/teeboth
+++ b/teeboth
@@ -11,7 +11,7 @@ use IO::Select;
 my $out = shift @ARGV;
 die unless @ARGV;
 
-open my $fout, ">", $out or die;
+open my $fout, ">>", $out or die if $out;
 
 my $select = IO::Select->new();
 my $alive = 1;
@@ -44,7 +44,7 @@ sub sethandle
        $flags |= O_NONBLOCK;
        fcntl ( $h, F_SETFL, $flags )
                or die "Couldn't set flags for HANDLE: $!\n";
-       
+
        $select->add( $h );
 }
 
@@ -54,7 +54,7 @@ sethandle( \*child_err );
 while ( $alive ) {
        foreach my $h ( $select->can_read() ) {
                sysread $h, $_, 1024;
-               print $fout $_;
+               print $fout $_ if $fout;
                if ( $h == \*child_err ) {
                        print "\033[31m$_\033[0m";
                } else {
This page took 0.037149 seconds and 4 git commands to generate.