about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-30 08:11:42 +0000
committerEric Wong <e@80x24.org>2021-10-30 18:34:33 +0000
commit8fbb1e5d9430b9403679c5701e109d43ad979f3f (patch)
tree65097c69b9f72bbfeb57c97f8aca797d76cf06e1 /t
parent97a9139a75729c41bb91acd711e8b088e6379600 (diff)
downloadpublic-inbox-8fbb1e5d9430b9403679c5701e109d43ad979f3f.tar.gz
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).
Diffstat (limited to 't')
-rw-r--r--t/lei-sigpipe.t7
1 files changed, 5 insertions, 2 deletions
diff --git a/t/lei-sigpipe.t b/t/lei-sigpipe.t
index f84d6d22..d9738b07 100644
--- a/t/lei-sigpipe.t
+++ b/t/lei-sigpipe.t
@@ -8,7 +8,7 @@ use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE);
 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)) {
@@ -27,7 +27,7 @@ EOM
                 }
 
                 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);
@@ -37,6 +37,9 @@ EOM
                 $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");
         }
 });