about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-19 20:32:34 +0000
committerEric Wong <e@80x24.org>2023-01-19 20:54:21 +0000
commita6a04af500851bcff8a5ef3341d522a3a0dbefe5 (patch)
tree3ca3b1ccded537ecc51e43e949cba77f2f8736e0
parent143d2aecda3649bca538b77dca63972e7a28949e (diff)
downloadpublic-inbox-a6a04af500851bcff8a5ef3341d522a3a0dbefe5.tar.gz
{quiet} is nice for quieting normal/expected errors (e.g `git diff'),
but we still want to show the command in case there's errors in
our own code.
-rw-r--r--lib/PublicInbox/Qspawn.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm
index 78afe718..c4708c0f 100644
--- a/lib/PublicInbox/Qspawn.pm
+++ b/lib/PublicInbox/Qspawn.pm
@@ -57,7 +57,8 @@ sub _do_spawn {
                         $o{$k} = $rlimit;
                 }
         }
-        $self->{cmd} = $o{quiet} ? undef : $cmd;
+        $self->{cmd} = $cmd;
+        $self->{-quiet} = 1 if $o{quiet};
         $o{cb_arg} = [ \&waitpid_err, $self ];
         eval {
                 # popen_rd may die on EMFILE, ENFILE
@@ -85,7 +86,7 @@ sub finalize ($) {
                 if (my $dst = $self->{qsp_err}) {
                         $$dst .= $$dst ? " $err" : "; $err";
                 }
-                warn "@{$self->{cmd}}: $err" if $self->{cmd};
+                warn "@{$self->{cmd}}: $err" if !$self->{-quiet};
         }
 
         my ($env, $qx_cb, $qx_arg, $qx_buf) =
@@ -216,9 +217,8 @@ sub rd_hdr ($) {
                                 warn "parse_hdr: $@";
                                 $ret = [ 500, [], [ "Internal error\n" ] ];
                         } elsif (!defined($ret) && !$r) {
-                                my $cmd = $self->{cmd} // [ '(?)' ];
                                 warn <<EOM;
-EOF parsing headers from @$cmd ($self->{psgi_env}->{REQUEST_URI})
+EOF parsing headers from @{$self->{cmd}} ($self->{psgi_env}->{REQUEST_URI})
 EOM
                                 $ret = [ 500, [], [ "Internal error\n" ] ];
                         }