]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiInput.pm
lei import: support UIDVALIDITY in IMAP URL
[public-inbox.git] / lib / PublicInbox / LeiInput.pm
index ce675f40b136d48ee683cd1a11a03c663b876a98..277ad88d99dd06b777a8469e28f42966b25c9c76 100644 (file)
@@ -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 <import|tag|convert>
        my $wait = $self->{lei}->{sto}->ipc_do('done') if $self->{lei}->{sto};
+       $self->{lei}->fail($err) if $err;
 }
 
 sub input_only_atfork_child {