about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorJulien Moutinho <julm+public-inbox@sourcephile.fr>2022-03-11 11:42:34 +0100
committerEric Wong <e@80x24.org>2022-03-14 22:05:42 +0000
commitf1e4e14793d155ea7d6ed7a6858b668e97c7e5d8 (patch)
tree97498e179ba2efe33c159aa1465aa8658cd26e15
parent3eec2f7792040f75f3988c520f308e2445baf645 (diff)
downloadpublic-inbox-f1e4e14793d155ea7d6ed7a6858b668e97c7e5d8.tar.gz
Ignoring a signal is different than blocking a signal, and the
"IgnoreSIGPIPE" option of systemd ignores.

[ew: note systemd behavior]

Acked-by: Eric Wong <e@80x24.org>
-rw-r--r--t/lei-sigpipe.t14
1 files changed, 5 insertions, 9 deletions
diff --git a/t/lei-sigpipe.t b/t/lei-sigpipe.t
index 7fab9aeb..55c208e2 100644
--- a/t/lei-sigpipe.t
+++ b/t/lei-sigpipe.t
@@ -4,20 +4,16 @@
 use strict;
 use v5.10.1;
 use PublicInbox::TestCommon;
-use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE SIG_UNBLOCK SIG_SETMASK sigprocmask);
+use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE);
 use PublicInbox::OnDestroy;
 
-# undo systemd (and similar) blocking SIGPIPE, since lei expects to be run
+# undo systemd (and similar) ignoring SIGPIPE, since lei expects to be run
 # from an interactive terminal:
 # https://public-inbox.org/meta/20220227080422.gyqowrxomzu6gyin@sourcephile.fr/
-my $set = POSIX::SigSet->new;
-my $old = POSIX::SigSet->new;
-$set->emptyset or xbail "sigemptyset $!";
-$old->emptyset or xbail "sigemptyset $!";
-$set->addset(SIGPIPE);
-sigprocmask(SIG_UNBLOCK, $set, $old) or xbail "SIG_UNBLOCK: $!";
+my $oldSIGPIPE = $SIG{PIPE};
+$SIG{PIPE} = 'DEFAULT';
 my $cleanup = PublicInbox::OnDestroy->new($$, sub {
-        sigprocmask(SIG_SETMASK, $old);
+        $SIG{PIPE} = $oldSIGPIPE;
 });
 
 test_lei(sub {