diff options
author | Eric Wong <e@80x24.org> | 2023-11-15 09:21:45 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-16 10:56:54 +0000 |
commit | 87981c405d27597a19f34b01a0763aed2be6dcf3 (patch) | |
tree | a1069781fc417200945e9b42921e4ca84850825e /lib/PublicInbox/LeiToMail.pm | |
parent | 72e0fcd979719f62bce89a029875e15a4cb497bb (diff) | |
download | public-inbox-87981c405d27597a19f34b01a0763aed2be6dcf3.tar.gz |
We need to consistently check the exit code of pigz|gzip|xz|bzip2 when writing to compressed mboxes (or bad storage).
Diffstat (limited to 'lib/PublicInbox/LeiToMail.pm')
-rw-r--r-- | lib/PublicInbox/LeiToMail.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index 0d62888d..007191bb 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -609,6 +609,17 @@ sub _pre_augment_mbox { undef; } +sub finish_output { + my ($self, $lei) = @_; + my $out = delete $lei->{1} // die 'BUG: no lei->{1}'; + my $old = delete $lei->{old_1}; + $lei->{1} = $old if $old; + return if $out->close; # reaps gzip|pigz|xz|bzip2 + my $msg = "E: Error closing $lei->{ovv}->{dst}"; + $? ? $lei->child_error($?) : ($msg .= " ($!)"); + die $msg; +} + sub _do_augment_mbox { my ($self, $lei) = @_; return unless $self->{seekable}; |