use File::Path qw(mkpath);
use File::Spec;
our $quit = \&CORE::exit;
+our $current_lei;
my ($recv_cmd, $send_cmd);
my $GLP = Getopt::Long::Parser->new;
$GLP->configure(qw(gnu_getopt no_ignore_case auto_abbrev));
sub dispatch {
my ($self, $cmd, @argv) = @_;
- local $SIG{__WARN__} = sub { err($self, @_) };
+ local $current_lei = $self; # for __WARN__
return _help($self, 'no command given') unless defined($cmd);
my $func = "lei_$cmd";
$func =~ tr/-/_/;
# STDOUT will cause the calling `lei' client process to finish
# reading the <$daemon> pipe.
openlog($path, 'pid', 'user');
- local $SIG{__WARN__} = sub { syslog('warning', "@_") };
+ local $SIG{__WARN__} = sub {
+ $current_lei ? err($current_lei, @_) : syslog('warning', "@_");
+ };
my $on_destroy = PublicInbox::OnDestroy->new($$, sub {
syslog('crit', "$@") if $@;
});
use strict;
use v5.10.1;
use parent qw(PublicInbox::LeiSearch PublicInbox::IPC);
-use Sys::Syslog qw(syslog);
sub new {
my ($class) = @_;
}
}
-sub ipc_atfork_child {
- my ($self) = @_;
- $SIG{__WARN__} = sub { syslog('warning', "@_") };
- $self->SUPER::ipc_atfork_child; # PublicInbox::IPC
-}
-
sub ipc_atfork_prepare {
my ($self) = @_;
$self->wq_set_recv_modes(qw[+<&= >&= >&= +<&=]);