From 90155b72ccd38d51415f12547e39c4d65c469fe1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 29 Apr 2021 09:46:19 +0000 Subject: lei import: support UIDVALIDITY in IMAP URL Specifying a UIDVALIDITY value allows the user to enforce a strict match and force failure. This necessitated changes to NetReader to allow die() and make error reporting more suitable for CLI usage rather than daemonized usage of -watch. --- lib/PublicInbox/LeiInput.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/LeiInput.pm') diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm index ce675f40..277ad88d 100644 --- a/lib/PublicInbox/LeiInput.pm +++ b/lib/PublicInbox/LeiInput.pm @@ -293,6 +293,7 @@ $input is `eml', not --in-format=$in_fmt $lei->err("# --sync is not supported for: @{$sync->{no}}"); } if ($net) { + $net->{-can_die} = 1; if (my $err = $net->errors) { return $lei->fail($err); } @@ -306,10 +307,17 @@ $input is `eml', not --in-format=$in_fmt sub process_inputs { my ($self) = @_; + my $err; for my $input (@{$self->{inputs}}) { - $self->input_path_url($input); + eval { $self->input_path_url($input) }; + next unless $@; + $err = "$input: $@"; + last; } + # always commit first, even on error partial work is acceptable for + # lei my $wait = $self->{lei}->{sto}->ipc_do('done') if $self->{lei}->{sto}; + $self->{lei}->fail($err) if $err; } sub input_only_atfork_child { -- cgit v1.2.3-24-ge0c7