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 D146E1F51A for ; Fri, 27 Oct 2023 22:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1698445276; bh=WpZdHuCbBv+7uGSnfYjmvTnKm2eVsu+P2kCXVU9VGuk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=4m4CBZS+en9lc6uDu7MBt4WcZPFi40kETbO9aquiJyxnOpMIEIs2/taWWGkzJXbdv hrtOdee3FVqbGe/dWPkp5NrvydyMJ2lst1vqeFIpD+vMrqht0fnPbAgyNk/iHY6h38 kV6x8+sdUSK2sdOhr7NImbUs0L5cSdti5mc88iaw= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 04/10] git: use run_qx to read `git --version' Date: Fri, 27 Oct 2023 22:21:10 +0000 Message-ID: <20231027222116.4034363-5-e@80x24.org> In-Reply-To: <20231027222116.4034363-1-e@80x24.org> References: <20231027222116.4034363-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It exists, now, so save us a few lines of code. --- lib/PublicInbox/Git.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index f4a24f2a..b5adc1f4 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -18,7 +18,7 @@ use Errno qw(EINTR EAGAIN); use File::Glob qw(bsd_glob GLOB_NOSORT); use File::Spec (); use Time::HiRes qw(stat); -use PublicInbox::Spawn qw(spawn popen_rd which); +use PublicInbox::Spawn qw(spawn popen_rd run_qx which); use PublicInbox::ProcessIONBF; use PublicInbox::Tmpfile; use IO::Poll qw(POLLIN); @@ -61,9 +61,8 @@ sub check_git_exe () { my @st = stat($GIT_EXE) or die "stat($GIT_EXE): $!"; my $st = pack('dd', $st[10], $st[7]); if ($st ne $EXE_ST) { - my $rd = popen_rd([ $GIT_EXE, '--version' ]); - my $v = readline($rd); - CORE::close($rd) or die "$GIT_EXE --version: $?"; + my $v = run_qx([ $GIT_EXE, '--version' ]); + die "$GIT_EXE --version: \$?=$?" if $?; $v =~ /\b([0-9]+(?:\.[0-9]+){2})/ or die "$GIT_EXE --version output: $v # unparseable"; $GIT_VER = eval("v$1") // die "BUG: bad vstring: $1 ($v)";