about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiOverview.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-19 09:34:32 +0000
committerEric Wong <e@80x24.org>2021-01-21 03:29:11 +0000
commit06d1b65df783d395a9f45b0b725b96c76eff80f3 (patch)
treeacdea14c7a71adbc47213c3e171749d69cc56697 /lib/PublicInbox/LeiOverview.pm
parenta14bc9e6cdd70f38eaa2961d1ea775300b9577ea (diff)
downloadpublic-inbox-06d1b65df783d395a9f45b0b725b96c76eff80f3.tar.gz
lei_overview: do not write if $lei->{1} is gone
We'll invalidate the {1} (stdout) field on SIGPIPE,
so don't trigger a Perl warning by writing to it.
Diffstat (limited to 'lib/PublicInbox/LeiOverview.pm')
-rw-r--r--lib/PublicInbox/LeiOverview.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiOverview.pm b/lib/PublicInbox/LeiOverview.pm
index 538d6bd5..8781259a 100644
--- a/lib/PublicInbox/LeiOverview.pm
+++ b/lib/PublicInbox/LeiOverview.pm
@@ -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";
         }
 }