]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
lei: use PublicInbox::Eml::warn_ignore_cb
authorEric Wong <e@80x24.org>
Sat, 14 Dec 2024 14:58:04 +0000 (14:58 +0000)
committerEric Wong <e@80x24.org>
Wed, 18 Dec 2024 21:42:17 +0000 (21:42 +0000)
The open-coded callback was identical to the existing callback
generated by our Eml package, so just use the existing code
instead unless a user uses `lei import --noisy'

lib/PublicInbox/LEI.pm

index 34ef95a150898e56a77f42f6c2957469d875bb85..1e8dc17f076c39bad147d57a37ce31118d5742fd 100644 (file)
@@ -625,12 +625,8 @@ sub _lei_atfork_child {
        eval 'no warnings; undef $PublicInbox::LeiNoteEvent::to_flush';
        undef $errors_log;
        $quit = \&CORE::exit;
-       if (!$self->{opt}->{noisy}) { # only "lei import" sets this atm
-               my $cb = $SIG{__WARN__} // \&CORE::warn;
-               $SIG{__WARN__} = sub {
-                       $cb->(@_) unless PublicInbox::Eml::warn_ignore(@_)
-               };
-       }
+       $self->{opt}->{noisy} or # only "lei import" sets this atm
+               $SIG{__WARN__} = PublicInbox::Eml::warn_ignore_cb();
        $SIG{TERM} = $term_handler;
        $current_lei = $persist ? undef : $self; # for SIG{__WARN__}
 }