]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/run: avoid uninitialized var on incomplete test
authorEric Wong <e@80x24.org>
Thu, 31 Dec 2020 13:51:44 +0000 (13:51 +0000)
committerEric Wong <e@80x24.org>
Fri, 1 Jan 2021 05:00:39 +0000 (05:00 +0000)
Diagnosing an occasional FIFO failure in t/lei_to_mail.t...

t/run.perl

index 1c7bcfc34db6fc3a24f28e468ee3d0d2f6f0827c..5c05635630e66ebf4b1640cbf0174aeddf27ab11 100755 (executable)
@@ -71,7 +71,8 @@ sub test_status () {
                my $skip = '';
                if (open my $fh, '<', $log) {
                        my @not_ok = grep(!/^(?:ok |[ \t]*#)/ms, <$fh>);
-                       pop @not_ok if $not_ok[-1] =~ /^[0-9]+\.\.[0-9]+$/;
+                       my $last = $not_ok[-1] // '';
+                       pop @not_ok if $last =~ /^[0-9]+\.\.[0-9]+$/;
                        my $pfx = "# $log: ";
                        print $OLDERR map { $pfx.$_ } @not_ok;
                        seek($fh, 0, SEEK_SET) or die "seek: $!";