about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiViewText.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/LeiViewText.pm')
-rw-r--r--lib/PublicInbox/LeiViewText.pm13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/PublicInbox/LeiViewText.pm b/lib/PublicInbox/LeiViewText.pm
index 2dad3b78..c7d72c71 100644
--- a/lib/PublicInbox/LeiViewText.pm
+++ b/lib/PublicInbox/LeiViewText.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # PublicInbox::Eml to (optionally colorized) text coverter for terminals
@@ -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 (!$r->close) {
+                warn "# @cmd failed, no color (non-fatal \$?=$?)\n";
                 return $self;
         }
         $self->{-colored} = \&my_colored;
@@ -243,7 +242,7 @@ sub add_text_buf { # callback for Eml->each_part
         my ($s, $err) = msg_part_text($part, $ct);
         return attach_note($self, $ct, $p, $fn) unless defined $s;
         hdr_buf($self, $part) if $part->{is_submsg};
-        $s =~ s/\r\n/\n/sg;
+        $s =~ s/\r+\n/\n/sg;
         _xs($s);
         my $diff = ($s =~ /^--- [^\n]+\n\+{3} [^\n]+\n@@ /ms);
         my @sections = PublicInbox::MsgIter::split_quotes($s);