]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
cindex: avoid awaitpid for popen
authorEric Wong <e@80x24.org>
Wed, 25 Oct 2023 00:29:43 +0000 (00:29 +0000)
committerEric Wong <e@80x24.org>
Wed, 25 Oct 2023 07:28:45 +0000 (07:28 +0000)
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.

lib/PublicInbox/CodeSearchIdx.pm

index c8e4c591504cf34f18841fd2c3aff62adacfb6f4..122bd4d49ed4afdd92e0bc142f246a3e3d919987 100644 (file)
@@ -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
 }