From: Eric Wong <e@80x24.org>
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 [thread overview]
Message-ID: <20210304090316.9568-6-e@80x24.org> (raw)
In-Reply-To: <20210304090316.9568-1-e@80x24.org>
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');
}
next prev parent reply other threads:[~2021-03-04 9:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 9:03 [PATCH 0/6] lei q --import-augment => --import-before; mbox + IMAP Eric Wong
2021-03-04 9:03 ` [PATCH 1/6] lei q: support --import-augment for IMAP Eric Wong
2021-03-04 9:03 ` [PATCH 2/6] lei: dclose: do not EPOLL_CTL_DEL w/o event_init Eric Wong
2021-03-04 9:03 ` [PATCH 3/6] lei_xsearch: cleanup {pkt_op_p} on exceptions Eric Wong
2021-03-04 9:03 ` [PATCH 4/6] lei q: --import-augment for mbox and mbox.gz Eric Wong
2021-03-04 9:03 ` Eric Wong [this message]
2021-03-04 9:03 ` [PATCH 6/6] lei q: s/import-augment/import-before/g Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210304090316.9568-6-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).