about summary refs log tree commit homepage
path: root/lib/PublicInbox/XapHelperCxx.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-27 22:21:13 +0000
committerEric Wong <e@80x24.org>2023-10-28 09:08:18 +0000
commit73830410e4336b779c820e90a8604e9e74f38b90 (patch)
tree92962cefd15d77edb12c57d08cc89b0d37110d67 /lib/PublicInbox/XapHelperCxx.pm
parentef5bd67cbcdcd8cba2cb8b3718ea90afda6b7ebe (diff)
downloadpublic-inbox-73830410e4336b779c820e90a8604e9e74f38b90.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/XapHelperCxx.pm')
-rw-r--r--lib/PublicInbox/XapHelperCxx.pm11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/PublicInbox/XapHelperCxx.pm b/lib/PublicInbox/XapHelperCxx.pm
index bd616b6f..83503035 100644
--- a/lib/PublicInbox/XapHelperCxx.pm
+++ b/lib/PublicInbox/XapHelperCxx.pm
@@ -7,7 +7,7 @@
 # The resulting executable is not linked to Perl in any way.
 package PublicInbox::XapHelperCxx;
 use v5.12;
-use PublicInbox::Spawn qw(popen_rd which);
+use PublicInbox::Spawn qw(run_qx which);
 use PublicInbox::Git qw(read_all);
 use PublicInbox::Search;
 use Fcntl qw(SEEK_SET);
@@ -29,14 +29,9 @@ my $xflags = ($ENV{CXXFLAGS} // '-Wall -ggdb3 -O0') . ' ' .
 my $xap_modversion;
 
 sub xap_cfg (@) {
-        use autodie qw(open seek);
-        open my $err, '+>', undef;
         my $cmd = [ $ENV{PKG_CONFIG} // 'pkg-config', @_, 'xapian-core' ];
-        my $rd = popen_rd($cmd, undef, { 2 => $err });
-        chomp(my $ret = do { local $/; <$rd> });
-        return $ret if close($rd);
-        seek($err, 0, SEEK_SET);
-        $err = read_all($err);
+        chomp(my $ret = run_qx($cmd, undef, { 2 => \(my $err) }));
+        return $ret if !$?;
         die <<EOM;
 @$cmd failed: Xapian development files missing? (\$?=$?)
 $err