]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/lei_to_mail: no need to cat in FIFO test
authorEric Wong <e@80x24.org>
Thu, 4 Mar 2021 09:03:15 +0000 (17:03 +0800)
committerEric Wong <e@80x24.org>
Thu, 4 Mar 2021 18:29:42 +0000 (14:29 -0400)
We're not forking, here, so there's no need to rely on FD_CLOEXEC
to resolve deadlock issues.

t/lei_to_mail.t

index 7898cc48396c55a01bca352a495a2fb1cc9a223f..585db689aa2a5cc7c2420c24b622fdd136c7ef6b 100644 (file)
@@ -6,8 +6,8 @@ use v5.10.1;
 use Test::More;
 use PublicInbox::TestCommon;
 use PublicInbox::Eml;
-use Fcntl qw(SEEK_SET);
-use PublicInbox::Spawn qw(popen_rd which);
+use Fcntl qw(SEEK_SET O_RDONLY O_NONBLOCK);
+use PublicInbox::Spawn qw(popen_rd);
 use List::Util qw(shuffle);
 require_mods(qw(DBD::SQLite));
 require PublicInbox::MdirReader;
@@ -242,11 +242,12 @@ SKIP: { # FIFO support
        use POSIX qw(mkfifo);
        my $fn = "$tmpdir/fifo";
        mkfifo($fn, 0600) or skip("mkfifo not supported: $!", 1);
-       my $cat = popen_rd([which('cat'), $fn]);
+       sysopen(my $cat, $fn, O_RDONLY|O_NONBLOCK) or BAIL_OUT $!;
        my $wcb = $wcb_get->('mboxo', $fn);
        $wcb->(\(my $x = $buf), $deadbeef);
        $commit->($wcb);
        my $cmp = '';
+       $cat->blocking(1);
        PublicInbox::MboxReader->mboxo($cat, sub { $cmp .= $as_orig->(@_) });
        is($cmp, $buf, 'message written to FIFO');
 }