about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-13 13:15:34 +0000
committerEric Wong <e@80x24.org>2023-11-13 21:54:55 +0000
commitfd8d93f37115813977b5a1dcb579dacd0199a56a (patch)
treea6f007371de125557af5167c6fa2c12176678bfc /lib/PublicInbox
parent82f45b6fa99380b02502046086fb7640065d44a1 (diff)
downloadpublic-inbox-fd8d93f37115813977b5a1dcb579dacd0199a56a.tar.gz
cindex: check `say' errors w/ close or ->flush
We actually need to rely on autodie `close' to check for errors,
since error-checking with `say' is not useful due to perlio
write buffering.  We'll also stop relying on `say ... or die'
since it's needless noise.

Fixes: 19f9089343c9 (cindex: drop redundant close on regular FH)
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/CodeSearchIdx.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 0b00c303..5b80db44 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -468,12 +468,12 @@ sub partition_refs ($$$) {
                 chomp $cmt;
                 my $n = hex(substr($cmt, 0, 8)) % scalar(@RDONLY_XDB);
                 if ($REINDEX && $REINDEX->set_maybe(pack('H*', $cmt), '')) {
-                        say { $shard_in[$n] } $cmt or die "say: $!";
+                        say { $shard_in[$n] } $cmt;
                         ++$NCHANGE;
                 } elsif (seen($RDONLY_XDB[$n], 'Q'.$cmt)) {
                         last if ++$seen > $SEEN_MAX;
                 } else {
-                        say { $shard_in[$n] } $cmt or die "say: $!";
+                        say { $shard_in[$n] } $cmt;
                         ++$NCHANGE;
                         $seen = 0;
                 }
@@ -845,7 +845,7 @@ EOM
                 PublicInbox::Import::init_bare($git_dir, 'cidx-all', $fmt);
                 open $ALT_FH{$hexlen}, '>', "$git_dir/objects/info/alternates";
         }
-        say { $ALT_FH{$hexlen} } $objdir or die "say: $!";
+        say { $ALT_FH{$hexlen} } $objdir;
 }
 
 sub prep_alternate_start {
@@ -969,7 +969,7 @@ sub dump_git_commits { # run_await cb
         (defined($pid) && $?) and die "E: @PRUNE_BATCH: \$?=$?";
         return if $DO_QUIT;
         my ($hexlen) = keys(%ALT_FH) or return; # done
-        delete $ALT_FH{$hexlen};
+        close(delete $ALT_FH{$hexlen}); # flushes `say' buffer
 
         $PRUNE_BATCH[1] = "--git-dir=$TMPDIR/hexlen$hexlen.git";
         run_await(\@PRUNE_BATCH, undef, $batch_opt, \&dump_git_commits);