our (%PATH2CFG, # persistent for socket daemon
$MDIR2CFGPATH, # /path/to/maildir => { /path/to/config => [ ino watches ] }
$OPT, # shared between optparse and opt_dash callback (for Getopt::Long)
+$daemon_pid
);
# TBD: this is a documentation mechanism to show a subcommand
stop_pager($self);
if ($self->{pkt_op_p}) { # worker => lei-daemon
$self->{pkt_op_p}->pkt_do('x_it', $code);
- exit($code >> 8);
+ exit($code >> 8) if $$ != $daemon_pid;
} elsif ($self->{sock}) { # lei->daemon => lei(1) client
send($self->{sock}, "x_it $code", 0);
} elsif ($quit == \&CORE::exit) { # an admin (one-shot) command
my $pid = fork;
return if $pid;
$0 = "lei-daemon $path";
- local %PATH2CFG;
- local $MDIR2CFGPATH;
+ local (%PATH2CFG, $MDIR2CFGPATH);
+ local $daemon_pid = $$;
$listener->blocking(0);
my $exit_code;
my $pil = PublicInbox::Listener->new($listener, \&accept_dispatch);