about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-17 23:37:57 +0000
committerEric Wong <e@80x24.org>2023-10-18 20:50:28 +0000
commit0d1eea1a2cbe4586c4c0589f5f01b8326de5e6d4 (patch)
tree8303cf12484d6f72db570cbda5089c3c6f9de4f5
parent2f8cbc7c4a5b5e328c2e6adeae4f320a08c5321a (diff)
downloadpublic-inbox-0d1eea1a2cbe4586c4c0589f5f01b8326de5e6d4.tar.gz
This saves us a few lines of code.
-rw-r--r--lib/PublicInbox/XapClient.pm11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/PublicInbox/XapClient.pm b/lib/PublicInbox/XapClient.pm
index 9e2d71a0..21c89265 100644
--- a/lib/PublicInbox/XapClient.pm
+++ b/lib/PublicInbox/XapClient.pm
@@ -11,14 +11,12 @@ use v5.12;
 use PublicInbox::Spawn qw(spawn);
 use Socket qw(AF_UNIX SOCK_SEQPACKET);
 use PublicInbox::IPC;
+use autodie qw(pipe socketpair);
 
 sub mkreq {
         my ($self, $ios, @arg) = @_;
-        my ($r, $w, $n);
-        if (!defined($ios->[0])) {
-                pipe($r, $w) or die "pipe: $!";
-                $ios->[0] = $w;
-        }
+        my ($r, $n);
+        pipe($r, $ios->[0]) if !defined($ios->[0]);
         my @fds = map fileno($_), @$ios;
         my $buf = join("\0", @arg, '');
         $n = $PublicInbox::IPC::send_cmd->($self->{io}, \@fds, $buf, 0) //
@@ -29,8 +27,7 @@ sub mkreq {
 
 sub start_helper {
         my @argv = @_;
-        socketpair(my $sock, my $in, AF_UNIX, SOCK_SEQPACKET, 0) or
-                die "socketpair: $!";
+        socketpair(my $sock, my $in, AF_UNIX, SOCK_SEQPACKET, 0);
         my $cls = ($ENV{PI_NO_CXX} ? undef : eval {
                         require PublicInbox::XapHelperCxx;
                         PublicInbox::XapHelperCxx::check_build();