2 # Copyright (C) 2021 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
7 use PublicInbox::TestCommon;
8 use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE);
9 require_mods(qw(json DBD::SQLite Search::Xapian));
10 # XXX this needs an already configured lei instance with many messages
13 my $env = shift // {};
14 pipe(my ($r, $w)) or BAIL_OUT $!;
15 open my $err, '+>', undef or BAIL_OUT $!;
16 my $opt = { run_mode => 0, 1 => $w, 2 => $err };
17 my $tp = start_script([qw(lei q -t), 'bytes:1..'], $env, $opt);
19 sysread($r, my $buf, 1);
20 close $r; # trigger SIGPIPE
22 ok(WIFSIGNALED($?), 'signaled');
23 is(WTERMSIG($?), SIGPIPE, 'got SIGPIPE');
25 my @err = grep(!m{mkdir /dev/null\b}, <$err>);
26 is_deeply(\@err, [], 'no errors');
30 $do_test->({XDG_RUNTIME_DIR => '/dev/null'});