From 73830410e4336b779c820e90a8604e9e74f38b90 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 27 Oct 2023 22:21:13 +0000 Subject: treewide: use run_qx where appropriate This saves us some code, and is a small step towards getting ProcessIO working with stat, fcntl and other perlops that don't work with tied handles. --- lib/PublicInbox/LeiMirror.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/LeiMirror.pm') diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 43e59e6c..c2f7cbed 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(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): $!"; - CORE::close($fh) 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 -- cgit v1.2.3-24-ge0c7