From: Eric Wong Date: Wed, 25 Oct 2023 00:29:43 +0000 (+0000) Subject: cindex: avoid awaitpid for popen X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74fd2b014d1cc4a6d52d721b8994da44f989b374;p=thirdparty%2Fpublic-inbox.git cindex: avoid awaitpid for popen We can use popen_rd to pass command and callbacks to a callback sub. This is another step which may allow us to get rid of the wantarray forms of popen_rd/popen_wr in the future. --- diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index c8e4c5915..122bd4d49 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -266,9 +266,9 @@ sub shard_index { # via wq_io_do in IDX_SHARDS my $in = delete($self->{0}) // die 'BUG: no {0} input'; my $op_p = delete($self->{1}) // die 'BUG: no {1} op_p'; sysseek($in, 0, SEEK_SET); - my ($rd, $pid) = $git->popen(@LOG_STDIN, undef, { 0 => $in }); + my $rd = popen_rd($git->cmd(@LOG_STDIN), undef, { 0 => $in }, + \&cidx_reap_log, $self, $op_p); close $in; - awaitpid($pid, \&cidx_reap_log, $self, $op_p); PublicInbox::CidxLogP->new($rd, $self, $git, $roots); # CidxLogP->event_step will call cidx_read_log_p once there's input }