From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/6] lei view_text: used tied ProcessPipe for `git config'
Date: Sun, 24 Sep 2023 05:42:10 +0000 [thread overview]
Message-ID: <20230924054214.3539091-3-e@80x24.org> (raw)
In-Reply-To: <20230924054214.3539091-1-e@80x24.org>
The code exists and is loaded anyways, so we might as well
save an explicit call to waitpid. Noticed while checking
over our uses of `git config'
---
lib/PublicInbox/LeiViewText.pm | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/LeiViewText.pm b/lib/PublicInbox/LeiViewText.pm
index 53555467..70441867 100644
--- a/lib/PublicInbox/LeiViewText.pm
+++ b/lib/PublicInbox/LeiViewText.pm
@@ -72,12 +72,11 @@ sub new {
my $self = bless { %{$lei->{opt}}, -colored => \&uncolored }, $cls;
$self->{-quote_reply} = 1 if $fmt eq 'reply';
return $self unless $self->{color} //= -t $lei->{1};
- my $cmd = [ qw(git config -z --includes -l) ];
- my ($r, $pid) = popen_rd($cmd, undef, { 2 => $lei->{2} });
+ my @cmd = qw(git config -z --includes -l); # reuse normal git config
+ my $r = popen_rd(\@cmd, undef, { 2 => $lei->{2} });
my $cfg = PublicInbox::Config::config_fh_parse($r, "\0", "\n");
- waitpid($pid, 0);
- if ($?) {
- warn "# git-config failed, no color (non-fatal)\n";
+ if (!close($r)) {
+ warn "# @cmd failed, no color (non-fatal \$?=$?)\n";
return $self;
}
$self->{-colored} = \&my_colored;
next prev parent reply other threads:[~2023-09-24 5:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-24 5:42 [PATCH 0/6] lei config fixes and improvements Eric Wong
2023-09-24 5:42 ` [PATCH 1/6] lei: check git-config(1) failures Eric Wong
2023-09-24 5:42 ` Eric Wong [this message]
2023-09-24 5:42 ` [PATCH 3/6] config: handle key-only entries as booleans Eric Wong
2023-09-24 5:42 ` [PATCH 4/6] lei config: send `git config' errors to pager Eric Wong
2023-09-24 5:42 ` [PATCH 5/6] lei: fix `-c NAME=VALUE' config support Eric Wong
2023-09-24 5:42 ` [PATCH 6/6] config: drop scalar ref support from internal API Eric Wong
2023-09-24 9:50 ` [SQUASH 7/6] t/config: fix missing coderepo.<PROJECT>.dir entry Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230924054214.3539091-3-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).