diff options
author | Eric Wong <e@80x24.org> | 2019-11-04 00:43:14 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-11-04 02:06:41 +0000 |
commit | b32b47fb12a3043d748f723802de923d9043d7ff (patch) | |
tree | 07291642fea1324a2469ecb9febc5fb4a5789d23 /lib/PublicInbox/SearchIdx.pm | |
parent | 17d2778c404c25c459f320a7f92913d17569fc59 (diff) | |
download | public-inbox-b32b47fb12a3043d748f723802de923d9043d7ff.tar.gz |
While I've never seen "git log" fail on its own, it could happen one day and we should be prepared to abort indexing when it happens. Beef up tests for t/spawn.t to ensure close() behaves on popen_rd the way we expect it to.
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdx.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index b2d71a1f..f265fa7f 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -590,6 +590,7 @@ sub read_log { $newest ||= $latest; } } + close($log) or die "git log failed: \$?=$?"; # get the leftovers foreach my $blob (keys %D) { my $mime = do_cat_mail($git, $blob, \$bytes) or next; @@ -632,7 +633,7 @@ sub _git_log { --no-notes --no-color --no-renames --diff-filter=AM), $range); ++$fcount while <$fh>; - close $fh; + close $fh or die "git log failed: \$?=$?"; my $high = $self->{mm}->num_highwater; $pr->("$fcount\n") if $pr; # continue previous line $self->{ntodo} = $fcount; @@ -713,7 +714,10 @@ sub _index_sync { my $xdb = $self->begin_txn_lazy; my $mm = _msgmap_init($self); do { - $xlog = undef; + if ($xlog) { + close($xlog) or die "git log failed: \$?=$?"; + $xlog = undef; + } $last_commit = _last_x_commit($self, $mm); $lx = reindex_from($opts->{reindex}, $last_commit); |