about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiSelfSocket.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/LeiSelfSocket.pm')
-rw-r--r--lib/PublicInbox/LeiSelfSocket.pm14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/PublicInbox/LeiSelfSocket.pm b/lib/PublicInbox/LeiSelfSocket.pm
index 860020cb..0e15bc7c 100644
--- a/lib/PublicInbox/LeiSelfSocket.pm
+++ b/lib/PublicInbox/LeiSelfSocket.pm
@@ -5,31 +5,27 @@
 # This receives what script/lei receives, but isn't connected
 # to an interactive terminal so I'm not sure what to do with it...
 package PublicInbox::LeiSelfSocket;
-use strict;
-use v5.10.1;
+use v5.12;
 use parent qw(PublicInbox::DS);
 use Data::Dumper;
 $Data::Dumper::Useqq = 1; # should've been the Perl default :P
 use PublicInbox::Syscall qw(EPOLLIN);
-use PublicInbox::Spawn;
-my $recv_cmd;
+use PublicInbox::IPC;
 
 sub new {
         my ($cls, $r) = @_;
-        my $self = bless { sock => $r }, $cls;
+        my $self = bless {}, $cls;
         $r->blocking(0);
-        no warnings 'once';
-        $recv_cmd = $PublicInbox::LEI::recv_cmd;
         $self->SUPER::new($r, EPOLLIN);
 }
 
 sub event_step {
         my ($self) = @_;
-        my (@fds) = $recv_cmd->($self->{sock}, my $buf, 4096 * 33);
+        my ($buf, @fds);
+        @fds = $PublicInbox::IPC::recv_cmd->($self->{sock}, $buf, 4096 * 33);
         if (scalar(@fds) == 1 && !defined($fds[0])) {
                 return if $!{EAGAIN};
                 die "recvmsg: $!" unless $!{ECONNRESET};
-                $buf = '';
         } else { # just in case open so perl can auto-close them:
                 for (@fds) { open my $fh, '+<&=', $_ };
         }