From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 091EA1F888 for ; Fri, 27 Oct 2023 09:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1698399642; bh=HYLZqEUiAv3fpAL/xIHq5fcztwst5p4lhiWiPVjAL9Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=zKKAz5A3V0oShJz1YwghleBTQx2B2eYs+gN76XYSkVb/LprbfqPm1SB5GTYaZk5Kw 7XeLIcz0f0Mnmw/tquTHtwy0ozMt9OPo0pp8qIFBmJIxCFAn67z0IdrVB5LNWc2GyI TtDz3XDb1lreRnRqAnaW+2TCEHmnGD55mHrDXiRs= From: Eric Wong To: spew@80x24.org Subject: [PATCH 14/18] lei_mirror: use run_qx Date: Fri, 27 Oct 2023 09:40:35 +0000 Message-ID: <20231027094039.3788289-14-e@80x24.org> In-Reply-To: <20231027094039.3788289-1-e@80x24.org> References: <20231027094039.3788289-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --- lib/PublicInbox/LeiMirror.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 49b38d43..413d869c 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -7,7 +7,7 @@ use v5.12; use parent qw(PublicInbox::IPC); use IO::Uncompress::Gunzip qw(gunzip $GunzipError); use IO::Compress::Gzip qw(gzip $GzipError); -use PublicInbox::Spawn qw(popen_rd spawn run_wait run_die); +use PublicInbox::Spawn qw(popen_rd spawn run_wait run_die run_qx); use File::Path (); use File::Temp (); use File::Spec (); @@ -57,9 +57,8 @@ sub try_scrape { my $curl = $self->{curl} //= PublicInbox::LeiCurl->new($lei) or return; my $cmd = $curl->for_uri($lei, $uri, '--compressed'); my $opt = { 0 => $lei->{0}, 2 => $lei->{2} }; - my $fh = popen_rd($cmd, undef, $opt); - my $html = do { local $/; <$fh> } // die "read(curl $uri): $!"; - $fh->close or return $lei->child_error($?, "@$cmd failed"); + my $html = run_qx($cmd, undef, $opt); + return $lei->child_error($?, "@$cmd failed") if $?; # we grep with URL below, we don't want Subject/From headers # making us clone random URLs. This assumes remote instances