X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Flei-sigpipe.t;h=55c208e2740c039327f26855964c94e12bcb5c5e;hb=bedc22c355d570ed07ff6600717a97226f791ff5;hp=6b2772a69a60796aa3277e76126560815bd9dcb0;hpb=47ab29704c99b8eab15aec885ce704b25f960023;p=public-inbox.git
diff --git a/t/lei-sigpipe.t b/t/lei-sigpipe.t
index 6b2772a6..55c208e2 100644
--- a/t/lei-sigpipe.t
+++ b/t/lei-sigpipe.t
@@ -1,10 +1,21 @@
#!perl -w
-# Copyright (C) 2021 all contributors
+# Copyright (C) all contributors
# License: AGPL-3.0+
use strict;
use v5.10.1;
use PublicInbox::TestCommon;
use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE);
+use PublicInbox::OnDestroy;
+
+# 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 $oldSIGPIPE = $SIG{PIPE};
+$SIG{PIPE} = 'DEFAULT';
+my $cleanup = PublicInbox::OnDestroy->new($$, sub {
+ $SIG{PIPE} = $oldSIGPIPE;
+});
+
test_lei(sub {
my $f = "$ENV{HOME}/big.eml";
my $imported;