--- trunk/lib/Frey/Shell/Grep.pm 2008/11/30 14:52:01 638 +++ trunk/lib/Frey/Shell/Grep.pm 2008/12/01 22:44:41 661 @@ -5,6 +5,8 @@ with 'Frey::Web'; #with 'Frey::Storage'; +use English; + has pattern => ( documentation => 'grep for pattern', is => 'rw', @@ -36,7 +38,7 @@ } |); - open(my $fh, '-|', $cmd) or die "ack: $@"; + open(my $fh, '-|', $cmd) || die "can't open pipe to $cmd $!"; while(<$fh>) { my ( $path, $line, $text ) = split(/:/,$_,3); if ( $path ne $last_path ) { @@ -46,7 +48,9 @@ $html .= qq|
$line $text|; $last_path = $path; } - close($fh) || die $!; + if ( $INPUT_LINE_NUMBER > 0 ) { # closing pipe grep output results in error + close($fh) || die "can't close pipe to $cmd $!"; + } $html .= qq||;