about summary refs log tree commit homepage
path: root/lib/PublicInbox/LEI.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-03 09:48:42 +0000
committerEric Wong <e@80x24.org>2021-01-03 18:24:02 +0000
commit0939882b8a883e3f034bd059cdec4984d36f4ac7 (patch)
tree30eca9c9e77272bc255a0eafccacdf74e03104c2 /lib/PublicInbox/LEI.pm
parent45f8f0fefb56723efe1b8ab0a1c041f5196e7a20 (diff)
downloadpublic-inbox-0939882b8a883e3f034bd059cdec4984d36f4ac7.tar.gz
IO::FDPass may be an extra installation burden I don't want to
impose on users.  We only support Linux and *BSDs, however.
Diffstat (limited to 'lib/PublicInbox/LEI.pm')
-rw-r--r--lib/PublicInbox/LEI.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 2bc4a916..6f98c934 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -25,6 +25,7 @@ use Text::Wrap qw(wrap);
 use File::Path qw(mkpath);
 use File::Spec;
 our $quit = \&CORE::exit;
+my $recv_fd;
 my $GLP = Getopt::Long::Parser->new;
 $GLP->configure(qw(gnu_getopt no_ignore_case auto_abbrev));
 my $GLP_PASS = Getopt::Long::Parser->new;
@@ -615,7 +616,7 @@ sub accept_dispatch { # Listener {post_accept} callback
         # `say $sock' triggers "die" in lei(1)
         for my $i (0..2) {
                 if (select(my $rout = $rin, undef, undef, 1)) {
-                        my $fd = IO::FDPass::recv(fileno($sock));
+                        my $fd = $recv_fd->(fileno($sock));
                         if ($fd >= 0) {
                                 my $rdr = ($fd == 0 ? '<&=' : '>&=');
                                 if (open(my $fh, $rdr, $fd)) {
@@ -671,7 +672,8 @@ sub lazy_start {
         my $dev_ino_expect = pack('dd', $st[0], $st[1]); # dev+ino
         pipe(my ($eof_r, $eof_w)) or die "pipe: $!";
         my $oldset = PublicInbox::Sigfd::block_signals();
-        require IO::FDPass;
+        $recv_fd = PublicInbox::Spawn->can('recv_fd') or die
+                "Inline::C not installed/configured or IO::FDPass missing\n";
         require PublicInbox::Listener;
         require PublicInbox::EOFpipe;
         (-p STDOUT) or die "E: stdout must be a pipe\n";