use bytes qw(length);
use IO::Handle (); # autoflush
use PublicInbox::Eml;
+use PublicInbox::Sigfd;
sub new {
my ($class, $v2w, $shard) = @_; # v2w may be ExtSearchIdx
my ($r, $w);
pipe($r, $w) or die "pipe failed: $!\n";
$w->autoflush(1);
+ my $oldset = PublicInbox::Sigfd::block_signals();
my $pid = fork;
defined $pid or die "fork failed: $!\n";
if ($pid == 0) {
+ # these signals are localized in parent
+ $SIG{$_} = 'IGNORE' for (qw(TERM INT QUIT));
+ PublicInbox::Sigfd::sig_setmask($oldset);
my $bnote = $v2w->atfork_child;
close $w or die "failed to close: $!";
die "unexpected MM $self->{mm}" if $self->{mm};
exit;
}
+ PublicInbox::Sigfd::sig_setmask($oldset);
$self->{pid} = $pid;
$self->{w} = $w;
close $r or die "failed to close: $!";
} elsif ($line =~ s/\A\+X //) {
my ($len, $docid, $oid, $eidx_key) =
split(/ /, $line, 4);
+ chomp $eidx_key;
$self->add_eidx_info($docid, $oid, $eidx_key,
eml($r, $len));
} elsif ($line =~ s/\A-X //) {
my ($len, $docid, $oid, $eidx_key) =
split(/ /, $line, 4);
+ chomp $eidx_key;
$self->remove_eidx_info($docid, $oid, $eidx_key,
eml($r, $len));
} else {