From 00fe4ec336dcd8fcf3c45498d7f1ae5c228c6b92 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 6 Oct 2023 01:02:58 +0000 Subject: ipc: lower-level send_cmd/recv_cmd handle EINTR directly This ensures script/lei $send_cmd usage is EINTR-safe (since I prefer to avoid loading PublicInbox::IPC for startup time). Overall, it saves us some code, too. --- lib/PublicInbox/LEI.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/LEI.pm') diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index e300f0a4..f8bcd43d 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -1041,7 +1041,7 @@ sub start_mua { sub send_exec_cmd { # tell script/lei to execute a command my ($self, $io, $cmd, $env) = @_; - PublicInbox::IPC::send_cmd( + $PublicInbox::IPC::send_cmd->( $self->{sock} // die('lei client gone'), [ map { fileno($_) } @$io ], exec_buf($cmd, $env), 0) // @@ -1139,7 +1139,7 @@ sub accept_dispatch { # Listener {post_accept} callback select($rvec, undef, undef, 60) or return send($sock, 'timed out waiting to recv FDs', 0); # (4096 * 33) >MAX_ARG_STRLEN - my @fds = PublicInbox::IPC::recv_cmd($sock, my $buf, 4096 * 33) or + my @fds = $PublicInbox::IPC::recv_cmd->($sock, my $buf, 4096 * 33) or return; # EOF if (!defined($fds[0])) { warn(my $msg = "recv_cmd failed: $!"); @@ -1178,7 +1178,7 @@ sub event_step { local %ENV = %{$self->{env}}; local $current_lei = $self; eval { - my @fds = PublicInbox::IPC::recv_cmd( + my @fds = $PublicInbox::IPC::recv_cmd->( $self->{sock} // return, my $buf, 4096); if (scalar(@fds) == 1 && !defined($fds[0])) { return if $! == EAGAIN; -- cgit v1.2.3-24-ge0c7