SIGPIPE and SIGTERM are common and user-induced, so they're
not worth warning on. Add the value of "$?", though, since
it can help users notice other errors (e.g. SIGSEGV).
sub xsearch_done_wait { # dwaitpid callback
my ($arg, $pid) = @_;
my ($wq, $lei) = @$arg;
sub xsearch_done_wait { # dwaitpid callback
my ($arg, $pid) = @_;
my ($wq, $lei) = @$arg;
- $lei->child_error($?, 'non-fatal error from '.ref($wq)) if $?;
+ return if !$?;
+ my $s = $? & 127;
+ return $lei->child_error($?) if $s == 13 || $s == 15;
+ $lei->child_error($?, 'non-fatal error from '.ref($wq)." \$?=$?");
}
sub query_done { # EOF callback for main daemon
}
sub query_done { # EOF callback for main daemon
test_lei(sub {
my $f = "$ENV{HOME}/big.eml";
my $imported;
test_lei(sub {
my $f = "$ENV{HOME}/big.eml";
my $imported;
- for my $out ([], [qw(-f mboxcl2)]) {
+ for my $out ([], [qw(-f mboxcl2)], [qw(-f text)]) {
pipe(my ($r, $w)) or BAIL_OUT $!;
my $size = 65536;
if ($^O eq 'linux' && fcntl($w, 1031, 4096)) {
pipe(my ($r, $w)) or BAIL_OUT $!;
my $size = 65536;
if ($^O eq 'linux' && fcntl($w, 1031, 4096)) {
}
lei_ok(qw(import), $f) if $imported++ == 0;
}
lei_ok(qw(import), $f) if $imported++ == 0;
- open my $errfh, '>>', "$ENV{HOME}/stderr.log" or xbail $!;
+ open my $errfh, '+>', "$ENV{HOME}/stderr.log" or xbail $!;
my $opt = { run_mode => 0, 2 => $errfh, 1 => $w };
my $cmd = [qw(lei q -q -t), @$out, 'z:1..'];
my $tp = start_script($cmd, undef, $opt);
my $opt = { run_mode => 0, 2 => $errfh, 1 => $w };
my $cmd = [qw(lei q -q -t), @$out, 'z:1..'];
my $tp = start_script($cmd, undef, $opt);
$tp->join;
ok(WIFSIGNALED($?), "signaled @$out");
is(WTERMSIG($?), SIGPIPE, "got SIGPIPE @$out");
$tp->join;
ok(WIFSIGNALED($?), "signaled @$out");
is(WTERMSIG($?), SIGPIPE, "got SIGPIPE @$out");
+ seek($errfh, 0, 0) or xbail $!;
+ my $s = do { local $/; <$errfh> };
+ is($s, '', "quiet after sigpipe @$out");