about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-04-30 09:24:34 +0000
committerEric Wong <e@80x24.org>2021-04-30 19:59:45 +0000
commit863bb9d1b131ea5933b58e485300dca030d6ade1 (patch)
tree5501bf431a57c9c6f86616aedd5c7820b5b3243c /lib
parent8bb96e2da15ce323024be8de8b89bc386ee33339 (diff)
downloadpublic-inbox-863bb9d1b131ea5933b58e485300dca030d6ade1.tar.gz
This fixes error reporting for oneshot tests in xt/lei-auth-failure.t
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/LEI.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 3468094f..6a82d497 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -500,6 +500,7 @@ sub _lei_atfork_child {
                 }
         } else { # worker, Net::NNTP (Net::Cmd) uses STDERR directly
                 open STDERR, '+>&='.fileno($self->{2}) or warn "open $!";
+                STDERR->autoflush(1);
         }
         close($_) for (grep(defined, delete @$self{qw(3 old_1 au_done)}));
         if (my $op_c = delete $self->{pkt_op_c}) {
@@ -676,6 +677,7 @@ sub lazy_cb ($$$) {
 sub dispatch {
         my ($self, $cmd, @argv) = @_;
         local $current_lei = $self; # for __WARN__
+        $self->{2}->autoflush(1); # keep stdout buffered until x_it|DESTROY
         dump_and_clear_log("from previous run\n");
         return _help($self, 'no command given') unless defined($cmd);
         # do not support Getopt bundling for this
@@ -1006,7 +1008,6 @@ sub accept_dispatch { # Listener {post_accept} callback
                 }
                 $i == 4 or return send($sock, 'not enough FDs='.($i-1), MSG_EOR)
         }
-        $self->{2}->autoflush(1); # keep stdout buffered until x_it|DESTROY
         # $ENV_STR = join('', map { "\0$_=$ENV{$_}" } keys %ENV);
         # $buf = "$argc\0".join("\0", @ARGV).$ENV_STR."\0\0";
         substr($buf, -2, 2, '') eq "\0\0" or  # s/\0\0\z//