#!perl -w
-# Copyright (C) 2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use v5.10.1;
use Socket qw(AF_UNIX SOCK_STREAM pack_sockaddr_un);
+my $send_3fds;
if (my ($sock, $pwd) = eval {
- require IO::FDPass; # will try to use a daemon to reduce load time
+ require PublicInbox::Spawn;
+ $send_3fds = PublicInbox::Spawn->can('send_3fds') or die
+ "Inline::C not installed/configured or IO::FDPass missing\n";
my $path = do {
my $runtime_dir = ($ENV{XDG_RUNTIME_DIR} // '') . '/lei';
if ($runtime_dir eq '/lei') {
$buf .= "\0\0";
select $sock;
$| = 1; # unbuffer selected $sock
- IO::FDPass::send(fileno($sock), $_) for (0..2);
+ $send_3fds->(fileno($sock), 0, 1, 2);
print $sock $buf or die "print(sock, buf): $!";
while ($buf = <$sock>) {
$buf =~ /\Aexit=([0-9]+)\n\z/ and exit($1 + 0);