diff options
author | Eric Wong <e@80x24.org> | 2023-10-17 23:38:02 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-18 20:50:32 +0000 |
commit | 48aca3659c248c936a978a8338cf19aacc9483a1 (patch) | |
tree | f58abcee6960e6f479f79f5d03f57469d479d0ac /t/lei-sigpipe.t | |
parent | 5406e15b4de72644e4bedb73029c94cad7af5d0a (diff) | |
download | public-inbox-48aca3659c248c936a978a8338cf19aacc9483a1.tar.gz |
We use this in various places to minimize or maximize pipe size on Linux. So keep it all in one place.
Diffstat (limited to 't/lei-sigpipe.t')
-rw-r--r-- | t/lei-sigpipe.t | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/t/lei-sigpipe.t b/t/lei-sigpipe.t index 55c208e2..622598a4 100644 --- a/t/lei-sigpipe.t +++ b/t/lei-sigpipe.t @@ -6,6 +6,7 @@ use v5.10.1; use PublicInbox::TestCommon; use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE); use PublicInbox::OnDestroy; +use PublicInbox::Syscall qw($F_SETPIPE_SZ); # undo systemd (and similar) ignoring SIGPIPE, since lei expects to be run # from an interactive terminal: @@ -21,10 +22,8 @@ test_lei(sub { my $imported; 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)) { - $size = 4096; - } + my $size = $F_SETPIPE_SZ && fcntl($w, $F_SETPIPE_SZ, 4096) ? + 4096 : 65536; unless (-f $f) { open my $fh, '>', $f or xbail "open $f: $!"; print $fh <<'EOM' or xbail; |