From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B78B01FA19 for ; Tue, 19 Jan 2021 09:34:35 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 6/9] lei_overview: do not write if $lei->{1} is gone Date: Tue, 19 Jan 2021 09:34:32 +0000 Message-Id: <20210119093435.17955-7-e@80x24.org> In-Reply-To: <20210119093435.17955-1-e@80x24.org> References: <20210119093435.17955-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We'll invalidate the {1} (stdout) field on SIGPIPE, so don't trigger a Perl warning by writing to it. --- lib/PublicInbox/LeiOverview.pm | 5 +++-- 1 file 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"; } }