lib/PublicInbox/LeiEditSearch.pm
lib/PublicInbox/LeiExportKw.pm
lib/PublicInbox/LeiExternal.pm
+lib/PublicInbox/LeiFinmsg.pm
lib/PublicInbox/LeiForgetMailSync.pm
lib/PublicInbox/LeiForgetSearch.pm
lib/PublicInbox/LeiHelp.pm
sub qerr ($;@) { $_[0]->{opt}->{quiet} or err(shift, @_) }
+sub qfin { # show message on finalization (LeiFinmsg)
+ my ($lei, $msg) = @_;
+ return if $lei->{opt}->{quiet};
+ $lei->{fmsg} ? push(@{$lei->{fmsg}}, "$msg\n") : qerr($lei, $msg);
+}
+
sub fail_handler ($;$$) {
my ($lei, $code, $io) = @_;
close($io) if $io; # needed to avoid warnings on SIGPIPE
--- /dev/null
+# Copyright (C) all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+
+# Finalization messages, used to queue up a bunch of messages which
+# only get written out on ->DESTROY
+package PublicInbox::LeiFinmsg;
+use strict;
+use v5.10.1;
+
+sub new {
+ my ($cls, $io) = @_;
+ bless [ $io ], $cls;
+}
+
+sub DESTROY {
+ my ($self) = @_;
+ my $io = shift @$self;
+ print $io @$self;
+}
+
+1;
sub up1_redispatch {
my ($lei, $out, $op_p) = @_;
+ require PublicInbox::LeiFinmsg;
+ $lei->{fmsg} //= PublicInbox::LeiFinmsg->new($lei->{2});
my $l = bless { %$lei }, ref($lei);
$l->{opt} = { %{$l->{opt}} };
delete $l->{sock};
if ($lei->{-progress}) {
my $tot = $lei->{-mset_total} // 0;
my $nr = $lei->{-nr_write} // 0;
- $lei->qerr($l2m ?
- "# $nr written to $lei->{ovv}->{dst} ($tot matches)" :
- "# $tot matches");
+ if ($l2m) {
+ $lei->qfin("# $nr written to " .
+ "$lei->{ovv}->{dst} ($tot matches)");
+ } else {
+ $lei->qerr("# $tot matches");
+ }
}
$lei->start_mua if $start_mua;
$lei->dclose;