From e938b62f571c82044fe3aaea05acaf47a7ddf22c Mon Sep 17 00:00:00 2001 From: Rob Hoelz Date: Mon, 18 Aug 2014 20:05:02 -0500 Subject: [PATCH] Fix infinite loop issue This addresses GH #481 --- ack | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ack b/ack index c2694462..0c7316aa 100644 --- a/ack +++ b/ack @@ -177,6 +177,12 @@ sub _compile_file_filter { my $is_inverted = $opt->{v}; return sub { + if ( -f STDOUT ) { + my ( $target_dev, $target_inode ) = stat($File::Next::name); + my ( $output_dev, $output_inode ) = stat(STDOUT); + + return if $target_dev == $output_dev && $target_inode == $output_inode; + } if ( $match_filenames ) { if ( $File::Next::name =~ /$match_regex/ && $is_inverted ) { return;