* [PATCH 1/4] process_io: fix binmode and use it in lei_xsearch for curl
@ 2023-10-08 11:45 Eric Wong
2023-10-08 11:45 ` [PATCH 2/4] lei rediff: use ProcessIO for --drq support Eric Wong
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2023-10-08 11:45 UTC (permalink / raw)
To: spew
The `binmode' perlop can only take two scalars, so passing
`@_' blindly won't work since prototypes are checked. This
means we can get IO::Uncompress::Gunzip working properly
with ProcessIO.
---
lib/PublicInbox/LeiXSearch.pm | 25 +++++++++++--------------
lib/PublicInbox/ProcessIO.pm | 4 ++--
t/lei-q-remote-import.t | 33 ++++++++++++++++++++-------------
3 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 4077191f..ef66aaea 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -21,6 +21,7 @@ use PublicInbox::LEI;
use Fcntl qw(SEEK_SET F_SETFL O_APPEND O_RDWR);
use PublicInbox::ContentHash qw(git_sha);
use POSIX qw(strftime);
+use autodie qw(seek truncate);
sub new {
my ($class) = @_;
@@ -353,29 +354,25 @@ sub query_remote_mboxrd {
$uri->query_form(@qform, q => $q);
my $cmd = $curl->for_uri($lei, $uri);
$lei->qerr("# $cmd");
- my ($fh, $pid) = popen_rd($cmd, undef, $rdr);
- my $reap_curl = PublicInbox::AutoReap->new($pid);
- $fh = IO::Uncompress::Gunzip->new($fh, MultiStream => 1);
+ my $cfh = popen_rd($cmd, undef, $rdr);
+ my $fh = IO::Uncompress::Gunzip->new($cfh, MultiStream => 1);
PublicInbox::MboxReader->mboxrd($fh, \&each_remote_eml, $self,
$lei, $each_smsg);
$lei->sto_done_request if delete($self->{-sto_imported});
- $reap_curl->join;
my $nr = delete $lei->{-nr_remote_eml} // 0;
- if ($? == 0) {
- # don't update if no results, maybe MTA is down
+ close $cfh;
+ if ($? == 0) { # don't update if no results, maybe MTA is down
$lei->{lss}->cfg_set($key, $start) if $key && $nr;
mset_progress($lei, $lei->{-current_url}, $nr, $nr);
next;
}
my $err;
- if (-s $cerr) {
- seek($cerr, 0, SEEK_SET) //
- warn "seek($cmd stderr): $!";
- $err = do { local $/; <$cerr> } //
- warn "read($cmd stderr): $!";
- truncate($cerr, 0) // warn "truncate($cmd stderr): $!";
- }
- $err //= '';
+ eval {
+ seek($cerr, 0, SEEK_SET);
+ read($cerr, $err, -s $cerr);
+ truncate($cerr, 0);
+ };
+ warn "E: $@ ($cmd stderr)" if $@;
next if (($? >> 8) == 22 && $err =~ /\b404\b/);
$uri->query_form(q => $qstr);
$lei->child_error($?, "E: <$uri> $err");
diff --git a/lib/PublicInbox/ProcessIO.pm b/lib/PublicInbox/ProcessIO.pm
index 5a81e3a6..f120edd0 100644
--- a/lib/PublicInbox/ProcessIO.pm
+++ b/lib/PublicInbox/ProcessIO.pm
@@ -33,8 +33,8 @@ sub TIEHANDLE {
# for IO::Uncompress::Gunzip
sub BINMODE {
- my $self = shift;
- binmode($self->{fh}, @_);
+ return binmode($_[0]->{fh}) if @_ == 1;
+ binmode $_[0]->{fh}, $_[1];
}
sub READ { read($_[0]->{fh}, $_[1], $_[2], $_[3] || 0) }
diff --git a/t/lei-q-remote-import.t b/t/lei-q-remote-import.t
index 92d8c9b6..885fa3e1 100644
--- a/t/lei-q-remote-import.t
+++ b/t/lei-q-remote-import.t
@@ -1,7 +1,8 @@
#!perl -w
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-use strict; use v5.10.1; use PublicInbox::TestCommon;
+use v5.12; use PublicInbox::TestCommon;
+use autodie qw(open close unlink);
require_mods(qw(lei -httpd));
require_cmd 'curl';
use PublicInbox::MboxReader;
@@ -16,7 +17,7 @@ my $url = "http://$host_port/t2/";
my $exp1 = [ eml_load('t/plack-qp.eml') ];
my $exp2 = [ eml_load('t/iso-2202-jp.eml') ];
my $slurp_emls = sub {
- open my $fh, '<', $_[0] or BAIL_OUT "open: $!";
+ open my $fh, '<', $_[0];
my @eml;
PublicInbox::MboxReader->mboxrd($fh, sub {
my $eml = shift;
@@ -31,33 +32,33 @@ test_lei({ tmpdir => $tmpdir }, sub {
my @cmd = ('q', '-o', "mboxrd:$o", 'm:qp@example.com');
lei_ok(@cmd);
ok(-f $o && !-s _, 'output exists but is empty');
- unlink $o or BAIL_OUT $!;
+ unlink $o;
lei_ok(@cmd, '-I', $url);
is_deeply($slurp_emls->($o), $exp1, 'got results after remote search');
- unlink $o or BAIL_OUT $!;
+ unlink $o;
lei_ok(@cmd);
ok(-f $o && -s _, 'output exists after import but is not empty') or
diag $lei_err;
is_deeply($slurp_emls->($o), $exp1, 'got results w/o remote search');
- unlink $o or BAIL_OUT $!;
+ unlink $o;
$cmd[-1] = 'm:199707281508.AAA24167@hoyogw.example';
lei_ok(@cmd, '-I', $url, '--no-import-remote');
is_deeply($slurp_emls->($o), $exp2, 'got another after remote search');
- unlink $o or BAIL_OUT $!;
+ unlink $o;
lei_ok(@cmd);
ok(-f $o && !-s _, '--no-import-remote did not memoize');
open my $fh, '>', "$o.lock";
$cmd[-1] = 'm:qp@example.com';
- unlink $o or xbail("unlink $o $! cwd=".Cwd::getcwd());
+ unlink $o;
lei_ok(@cmd, '--lock=none');
ok(-f $o && -s _, '--lock=none respected') or diag $lei_err;
- unlink $o or xbail("unlink $o $! cwd=".Cwd::getcwd());
+ unlink $o;
ok(!lei(@cmd, '--lock=dotlock,timeout=0.000001'), 'dotlock fails');
like($lei_err, qr/dotlock timeout/, 'timeout noted');
ok(-f $o && !-s _, 'nothing output on lock failure');
- unlink "$o.lock" or BAIL_OUT $!;
+ unlink "$o.lock";
lei_ok(@cmd, '--lock=dotlock,timeout=0.000001',
\'succeeds after lock removal');
@@ -76,8 +77,8 @@ test_lei({ tmpdir => $tmpdir }, sub {
'm:testmessage@example.com');
is($lei_out, '', 'message not imported when in local external');
- open $fh, '>', $o or BAIL_OUT;
- print $fh <<'EOF' or BAIL_OUT;
+ open $fh, '>', $o;
+ print $fh <<'EOF';
From a@z Mon Sep 17 00:00:00 2001
From: nobody@localhost
Date: Sat, 13 Mar 2021 18:23:01 +0600
@@ -86,7 +87,7 @@ Status: OR
whatever
EOF
- close $fh or BAIL_OUT;
+ close $fh;
lei_ok(qw(q -o), "mboxrd:$o", 'm:testmessage@example.com');
is_deeply($slurp_emls->($o), [$exp],
'got expected result after clobber') or diag $lei_err;
@@ -103,5 +104,11 @@ EOF
lei_ok([qw(edit-search), "$ENV{HOME}/md"], $edit_env);
like($lei_out, qr/^\Q[external "$url"]\E\n\s*lastresult = \d+/sm,
'lastresult set');
+
+ unlink $o;
+ lei_ok qw(q --no-save -q m:never2exist@example.com -o), "mboxrd:$o",
+ '--only', $url,
+ \'404 curl exit (22) does not influence lei(1)';
+ is(-s $o, 0, 'empty result');
});
done_testing;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/4] lei rediff: use ProcessIO for --drq support
2023-10-08 11:45 [PATCH 1/4] process_io: fix binmode and use it in lei_xsearch for curl Eric Wong
@ 2023-10-08 11:45 ` Eric Wong
2023-10-08 11:45 ` [PATCH 3/4] lei_xsearch: improve curl progress reporting Eric Wong
2023-10-08 11:45 ` [PATCH 4/4] lei_{input,remote}: drop AutoReap usage for curl Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2023-10-08 11:45 UTC (permalink / raw)
To: spew
This required fixing binmode support a few commits ago, along
with properly enabling autoflush in popen_wr instead of setting
it on the wrapper ProcessIO class.
---
lib/PublicInbox/LeiRediff.pm | 33 ++++++++++++++-------------------
lib/PublicInbox/ProcessIO.pm | 18 +++++-------------
lib/PublicInbox/Spawn.pm | 1 +
3 files changed, 20 insertions(+), 32 deletions(-)
diff --git a/lib/PublicInbox/LeiRediff.pm b/lib/PublicInbox/LeiRediff.pm
index b894342b..230f3e83 100644
--- a/lib/PublicInbox/LeiRediff.pm
+++ b/lib/PublicInbox/LeiRediff.pm
@@ -138,35 +138,30 @@ EOM
undef;
}
-sub wait_requote { # OnDestroy callback
- my ($lei, $pid, $old_1) = @_;
- $lei->{1} = $old_1; # closes stdin of `perl -pe 's/^/> /'`
- waitpid($pid, 0) == $pid or die "BUG(?) waitpid: \$!=$! \$?=$?";
- $lei->child_error($?) if $?;
-}
+# awaitpid callback
+sub wait_requote { $_[1]->child_error($?) if $? }
-sub requote ($$) {
+sub requote ($$) { # '> ' prefix(es) lei->{1}
my ($lei, $pfx) = @_;
- my $old_1 = $lei->{1};
- my $opt = { 1 => $old_1, 2 => $lei->{2} };
+ my $opt = { 1 => $lei->{1}, 2 => $lei->{2} };
# $^X (perl) is overkill, but maybe there's a weird system w/o sed
- my ($w, $pid) = popen_wr([$^X, '-pe', "s/^/$pfx/"], $lei->{env}, $opt);
- $w->autoflush(1);
- binmode $w, ':utf8'; # incompatible with ProcessIO due to syswrite
- $lei->{1} = $w;
- PublicInbox::OnDestroy->new(\&wait_requote, $lei, $pid, $old_1);
+ my $w = popen_wr([$^X, '-pe', "s/^/$pfx/"], $lei->{env}, $opt,
+ \&wait_requote, $lei);
+ binmode $w, ':utf8';
+ $w;
}
sub extract_oids { # Eml each_part callback
my ($ary, $self) = @_;
+ my $lei = $self->{lei};
my ($p, undef, $idx) = @$ary;
- $self->{lei}->out($p->header_obj->as_string, "\n");
+ $lei->out($p->header_obj->as_string, "\n");
my ($s, undef) = msg_part_text($p, $p->content_type || 'text/plain');
defined $s or return;
- my $rq;
- if ($self->{dqre} && $s =~ s/$self->{dqre}//g) { # '> ' prefix(es)
- $rq = requote($self->{lei}, $1) if $self->{lei}->{opt}->{drq};
- }
+
+ $self->{dqre} && $s =~ s/$self->{dqre}//g && $lei->{opt}->{drq} and
+ local $lei->{1} = requote($lei, $1);
+
my @top = split($PublicInbox::ViewDiff::EXTRACT_DIFFS, $s);
undef $s;
my $blobs = $self->{blobs}; # blobs to resolve
diff --git a/lib/PublicInbox/ProcessIO.pm b/lib/PublicInbox/ProcessIO.pm
index f120edd0..ea5d3e6c 100644
--- a/lib/PublicInbox/ProcessIO.pm
+++ b/lib/PublicInbox/ProcessIO.pm
@@ -7,6 +7,7 @@ package PublicInbox::ProcessIO;
use v5.12;
use PublicInbox::DS qw(awaitpid);
use Symbol qw(gensym);
+use bytes qw(length);
sub maybe_new {
my ($cls, $pid, $fh, @cb_arg) = @_;
@@ -31,25 +32,16 @@ sub TIEHANDLE {
$self;
}
-# for IO::Uncompress::Gunzip
-sub BINMODE {
- return binmode($_[0]->{fh}) if @_ == 1;
- binmode $_[0]->{fh}, $_[1];
-}
+# for IO::Uncompress::Gunzip and PublicInbox::LeiRediff
+sub BINMODE { @_ == 1 ? binmode($_[0]->{fh}) : binmode($_[0]->{fh}, $_[1]) }
sub READ { read($_[0]->{fh}, $_[1], $_[2], $_[3] || 0) }
sub READLINE { readline($_[0]->{fh}) }
-sub WRITE {
- use bytes qw(length);
- syswrite($_[0]->{fh}, $_[1], $_[2] // length($_[1]), $_[3] // 0);
-}
+sub WRITE { syswrite($_[0]->{fh}, $_[1], $_[2] // length($_[1]), $_[3] // 0) }
-sub PRINT {
- my $self = shift;
- print { $self->{fh} } @_;
-}
+sub PRINT { print { $_[0]->{fh} } @_[1..$#_] }
sub FILENO { fileno($_[0]->{fh}) }
diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm
index ec256698..b1e58f54 100644
--- a/lib/PublicInbox/Spawn.pm
+++ b/lib/PublicInbox/Spawn.pm
@@ -375,6 +375,7 @@ sub popen_rd {
sub popen_wr {
my ($cmd, $env, $opt, @cb_arg) = @_;
pipe(local $opt->{0}, my $w) or die "pipe: $!\n";
+ $w->autoflush(1);
my $pid = spawn($cmd, $env, $opt);
PublicInbox::ProcessIO->maybe_new($pid, $w, @cb_arg)
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/4] lei_xsearch: improve curl progress reporting
2023-10-08 11:45 [PATCH 1/4] process_io: fix binmode and use it in lei_xsearch for curl Eric Wong
2023-10-08 11:45 ` [PATCH 2/4] lei rediff: use ProcessIO for --drq support Eric Wong
@ 2023-10-08 11:45 ` Eric Wong
2023-10-08 11:45 ` [PATCH 4/4] lei_{input,remote}: drop AutoReap usage for curl Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2023-10-08 11:45 UTC (permalink / raw)
To: spew
Instead of having tail(1) follow a file when we're in verbose
mode, unconditionally pipe stderr to a Perl 2-liner which tees
its output to a regular file with line buffering.
POSIX tee(1) isn't suitable for this task since it's required
to be completely unbuffered while we want line-buffering when
running parallel processes. Fortunately, Perl makes this easy.
This also means we no longer leave curl-err.XXXX files around
on premature shutdown if we're hit by a SIGKILL or similar and
can't exit normally.
We do need to stop and respawn the Perl process if we hit a curl
error, though, since we need to be certain the output is
flushed.
---
lib/PublicInbox/LeiXSearch.pm | 48 +++++++++++++++++------------------
1 file changed, 23 insertions(+), 25 deletions(-)
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index ef66aaea..bfa91200 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -12,16 +12,15 @@ use PublicInbox::DS qw(now);
use File::Temp 0.19 (); # 0.19 for ->newdir
use File::Spec ();
use PublicInbox::Search qw(xap_terms);
-use PublicInbox::Spawn qw(popen_rd spawn which);
+use PublicInbox::Spawn qw(popen_rd popen_wr which);
use PublicInbox::MID qw(mids);
use PublicInbox::Smsg;
-use PublicInbox::AutoReap;
use PublicInbox::Eml;
use PublicInbox::LEI;
use Fcntl qw(SEEK_SET F_SETFL O_APPEND O_RDWR);
use PublicInbox::ContentHash qw(git_sha);
use POSIX qw(strftime);
-use autodie qw(seek truncate);
+use autodie qw(open read seek truncate);
sub new {
my ($class) = @_;
@@ -330,19 +329,19 @@ sub query_remote_mboxrd {
$qstr =~ s/[ \n\t]+/ /sg; # make URLs less ugly
my @qform = (x => 'm');
push(@qform, t => 1) if $opt->{threads};
- my $verbose = $opt->{verbose};
- my $reap_tail;
- my $cerr = File::Temp->new(TEMPLATE => 'curl.err-XXXX', TMPDIR => 1);
+ open my $cerr, '+>', undef;
fcntl($cerr, F_SETFL, O_APPEND|O_RDWR) or warn "set O_APPEND: $!";
- my $rdr = { 2 => $cerr };
- if ($verbose) {
- # spawn a process to force line-buffering, otherwise curl
- # will write 1 character at-a-time and parallel outputs
- # mmmaaayyy llloookkk llliiikkkeee ttthhhiiisss
- my $o = { 1 => $lei->{2}, 2 => $lei->{2} };
- my $pid = spawn(['tail', '-f', $cerr->filename], undef, $o);
- $reap_tail = PublicInbox::AutoReap->new($pid);
- }
+
+ # spawn a line-buffered tee(1) script, otherwise curl
+ # will write 1 character at-a-time and parallel outputs
+ # mmmaaayyy llloookkk llliiikkkeee ttthhhiiisss
+ # (n.b. POSIX tee(1) cannot do any buffering)
+ my $topt = { 1 => $cerr, 2 => $lei->{2} };
+ my $rdr;
+ my $lbf_tee = [ $^X, qw(-w -p -e), <<'' ];
+BEGIN { $| = 1; use IO::Handle; STDERR->autoflush(1); }
+print STDERR $_;
+
my $curl = PublicInbox::LeiCurl->new($lei, $self->{curl}) or return;
push @$curl, '-s', '-d', '';
my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei);
@@ -354,6 +353,7 @@ sub query_remote_mboxrd {
$uri->query_form(@qform, q => $q);
my $cmd = $curl->for_uri($lei, $uri);
$lei->qerr("# $cmd");
+ $rdr->{2} //= popen_wr($lbf_tee, undef, $topt);
my $cfh = popen_rd($cmd, undef, $rdr);
my $fh = IO::Uncompress::Gunzip->new($cfh, MultiStream => 1);
PublicInbox::MboxReader->mboxrd($fh, \&each_remote_eml, $self,
@@ -361,21 +361,19 @@ sub query_remote_mboxrd {
$lei->sto_done_request if delete($self->{-sto_imported});
my $nr = delete $lei->{-nr_remote_eml} // 0;
close $cfh;
- if ($? == 0) { # don't update if no results, maybe MTA is down
+ my $code = $?;
+ if (!$code) { # don't update if no results, maybe MTA is down
$lei->{lss}->cfg_set($key, $start) if $key && $nr;
mset_progress($lei, $lei->{-current_url}, $nr, $nr);
next;
}
- my $err;
- eval {
- seek($cerr, 0, SEEK_SET);
- read($cerr, $err, -s $cerr);
- truncate($cerr, 0);
- };
- warn "E: $@ ($cmd stderr)" if $@;
- next if (($? >> 8) == 22 && $err =~ /\b404\b/);
+ close(delete($rdr->{2}));
+ seek($cerr, 0, SEEK_SET);
+ read($cerr, my $err, -s $cerr);
+ truncate($cerr, 0);
+ next if (($code >> 8) == 22 && $err =~ /\b404\b/);
$uri->query_form(q => $qstr);
- $lei->child_error($?, "E: <$uri> $err");
+ $lei->child_error($code, "E: <$uri> `$cmd` failed");
}
undef $each_smsg;
$lei->{ovv}->ovv_atexit_child($lei);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 4/4] lei_{input,remote}: drop AutoReap usage for curl
2023-10-08 11:45 [PATCH 1/4] process_io: fix binmode and use it in lei_xsearch for curl Eric Wong
2023-10-08 11:45 ` [PATCH 2/4] lei rediff: use ProcessIO for --drq support Eric Wong
2023-10-08 11:45 ` [PATCH 3/4] lei_xsearch: improve curl progress reporting Eric Wong
@ 2023-10-08 11:45 ` Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2023-10-08 11:45 UTC (permalink / raw)
To: spew
We can use ProcessIO directly and just close synchronously
now that ProcessIO->BINMODE works properly.
---
lib/PublicInbox/LeiInput.pm | 11 +++++------
lib/PublicInbox/LeiRemote.pm | 13 +++++--------
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm
index 93f8b6b8..4fd50416 100644
--- a/lib/PublicInbox/LeiInput.pm
+++ b/lib/PublicInbox/LeiInput.pm
@@ -7,7 +7,6 @@ use v5.12;
use PublicInbox::DS;
use PublicInbox::Spawn qw(which popen_rd);
use PublicInbox::InboxWritable qw(eml_from_path);
-use PublicInbox::AutoReap;
# JMAP RFC 8621 4.1.1
# https://www.iana.org/assignments/imap-jmap-keywords/imap-jmap-keywords.xhtml
@@ -114,14 +113,14 @@ sub handle_http_input ($$@) {
push @$curl, '-s', @$curl_opt;
my $cmd = $curl->for_uri($lei, $uri);
$lei->qerr("# $cmd");
- my ($fh, $pid) = popen_rd($cmd, undef, { 2 => $lei->{2} });
- my $ar = PublicInbox::AutoReap->new($pid);
+ my $fh = popen_rd($cmd, undef, { 2 => $lei->{2} });
+ my $cfh;
grep(/\A--compressed\z/, @$curl) or
- $fh = IO::Uncompress::Gunzip->new($fh, MultiStream => 1);
+ $fh = IO::Uncompress::Gunzip->new($cfh = $fh, MultiStream => 1);
eval { $self->input_fh('mboxrd', $fh, $url, @args) };
my @err = ($@ ? $@ : ());
- $ar->join;
- push(@err, "\$?=$?") if $?;
+ close $cfh if $cfh;
+ push(@err, "\$?=$?") if $?; # MboxReader closes
$lei->child_error($?, "@$cmd failed: @err") if @err;
}
diff --git a/lib/PublicInbox/LeiRemote.pm b/lib/PublicInbox/LeiRemote.pm
index 15013baa..4b65997b 100644
--- a/lib/PublicInbox/LeiRemote.pm
+++ b/lib/PublicInbox/LeiRemote.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Make remote externals HTTP(S) inboxes behave like
@@ -6,13 +6,11 @@
# This exists solely for SolverGit. It is a high-latency a
# synchronous API that is not at all fast.
package PublicInbox::LeiRemote;
-use v5.10.1;
-use strict;
+use v5.12;
use IO::Uncompress::Gunzip;
use PublicInbox::MboxReader;
use PublicInbox::Spawn qw(popen_rd);
use PublicInbox::LeiCurl;
-use PublicInbox::AutoReap;
use PublicInbox::ContentHash qw(git_sha);
sub new {
@@ -47,13 +45,12 @@ sub mset {
$uri->query_form(q => $qstr, x => 'm', r => 1); # r=1: relevance
my $cmd = $curl->for_uri($self->{lei}, $uri);
$self->{lei}->qerr("# $cmd");
- my ($fh, $pid) = popen_rd($cmd, undef, { 2 => $lei->{2} });
- my $ar = PublicInbox::AutoReap->new($pid);
+ my $cfh = popen_rd($cmd, undef, { 2 => $lei->{2} });
$self->{smsg} = [];
- $fh = IO::Uncompress::Gunzip->new($fh, MultiStream => 1);
+ my $fh = IO::Uncompress::Gunzip->new($cfh, MultiStream => 1);
PublicInbox::MboxReader->mboxrd($fh, \&_each_mboxrd_eml, $self);
$self->{lei}->sto_done_request;
- $ar->join;
+ close $cfh;
$lei->child_error($?) if $?;
$self; # we are the mset (and $ibx, and $self)
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-08 11:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-08 11:45 [PATCH 1/4] process_io: fix binmode and use it in lei_xsearch for curl Eric Wong
2023-10-08 11:45 ` [PATCH 2/4] lei rediff: use ProcessIO for --drq support Eric Wong
2023-10-08 11:45 ` [PATCH 3/4] lei_xsearch: improve curl progress reporting Eric Wong
2023-10-08 11:45 ` [PATCH 4/4] lei_{input,remote}: drop AutoReap usage for curl Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).