From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CA6641FB0E for ; Thu, 4 Mar 2021 09:03:16 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/6] t/lei_to_mail: no need to cat in FIFO test Date: Thu, 4 Mar 2021 17:03:15 +0800 Message-Id: <20210304090316.9568-6-e@80x24.org> In-Reply-To: <20210304090316.9568-1-e@80x24.org> References: <20210304090316.9568-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We're not forking, here, so there's no need to rely on FD_CLOEXEC to resolve deadlock issues. --- t/lei_to_mail.t | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/lei_to_mail.t b/t/lei_to_mail.t index 7898cc48..585db689 100644 --- a/t/lei_to_mail.t +++ b/t/lei_to_mail.t @@ -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'); }