about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiToMail.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-25 05:49:45 +0000
committerEric Wong <e@80x24.org>2021-09-25 08:53:45 +0000
commit562cae2dc6dfd8b6ae85094115f67fe8d57cec8e (patch)
tree5cef06fb153ff3bfc908e55e9376ce09a696337d /lib/PublicInbox/LeiToMail.pm
parent50417b5469245feef84789f0bb540a3780dc14b4 (diff)
downloadpublic-inbox-562cae2dc6dfd8b6ae85094115f67fe8d57cec8e.tar.gz
I'm not sure what caused it, but $err was undef and caused print
to fail, leading to an event loop error.  Guard the timer with
an eval and assume warn() can't trigger an event loop failure.
Diffstat (limited to 'lib/PublicInbox/LeiToMail.pm')
-rw-r--r--lib/PublicInbox/LeiToMail.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm
index ed609081..467b27bf 100644
--- a/lib/PublicInbox/LeiToMail.pm
+++ b/lib/PublicInbox/LeiToMail.pm
@@ -789,12 +789,15 @@ sub wq_atexit_child {
 # runs on a 1s timer in lei-daemon
 sub augment_inprogress {
         my ($err, $opt, $dst, $au_noted) = @_;
-        $$au_noted++ and return;
-        print $err '# '.($opt->{'import-before'} ?
-                        "importing non-external contents of $dst" : (
-                        ($opt->{dedupe} // 'content') ne 'none') ?
-                        "scanning old contents of $dst for dedupe" :
-                        "removing old contents of $dst")." ...\n";
+        eval {
+                return if $$au_noted++ || !$err || !defined(fileno($err));
+                print $err '# '.($opt->{'import-before'} ?
+                                "importing non-external contents of $dst" : (
+                                ($opt->{dedupe} // 'content') ne 'none') ?
+                                "scanning old contents of $dst for dedupe" :
+                                "removing old contents of $dst")." ...\n";
+        };
+        warn "E: $@" if $@;
 }
 
 # called in top-level lei-daemon when LeiAuth is done