]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_overview: do not write if $lei->{1} is gone
authorEric Wong <e@80x24.org>
Tue, 19 Jan 2021 09:34:32 +0000 (09:34 +0000)
committerEric Wong <e@80x24.org>
Thu, 21 Jan 2021 03:29:11 +0000 (03:29 +0000)
We'll invalidate the {1} (stdout) field on SIGPIPE,
so don't trigger a Perl warning by writing to it.

lib/PublicInbox/LeiOverview.pm

index 538d6bd56cbf1d1bb530a8ca07f846f82dba0f1f..8781259addfb8bb33440dc7c337f4f1f15a59a7a 100644 (file)
@@ -99,12 +99,13 @@ sub ovv_begin {
 # called once by parent (via PublicInbox::EOFpipe)
 sub ovv_end {
        my ($self, $lei) = @_;
+       my $out = $lei->{1} or return;
        if ($self->{fmt} eq 'json') {
                # JSON doesn't allow trailing commas, and preventing
                # trailing commas is a PITA when parallelizing outputs
-               print { $lei->{1} } "null]\n";
+               print $out "null]\n";
        } elsif ($self->{fmt} eq 'concatjson') {
-               print { $lei->{1} } "\n";
+               print $out "\n";
        }
 }