From: Eric Wong <e@80x24.org>
Date: Tue, 2 Feb 2021 11:46:53 +0000 (+0000)
Subject: lei_xsearch: truncate curl stderr after reading it
X-Git-Tag: v1.7.0~1241
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c27867da3ad7025a30e923414343262b035ed133;p=public-inbox.git

lei_xsearch: truncate curl stderr after reading it

We may have further URLs to read in that process, so ensure
we don't end up having tail send stale data.
---

diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 95862306..5cf02136 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -268,6 +268,7 @@ sub query_remote_mboxrd {
 		my $e = do { local $/; <$cerr> } //
 				die "read(curl stderr): $!\n";
 		$coff += length($e);
+		truncate($cerr, 0);
 		next if (($? >> 8) == 22 && $e =~ /\b404\b/);
 		$lei->child_error($?);
 		$uri->query_form(q => $lei->{mset_opt}->{qstr});