From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 03C2C1FA19 for ; Fri, 30 Apr 2021 09:24:39 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/8] lei: ensure autoflush(1) is on STDERR Date: Fri, 30 Apr 2021 09:24:34 +0000 Message-Id: <20210430092438.20926-5-e@80x24.org> In-Reply-To: <20210430092438.20926-1-e@80x24.org> References: <20210430092438.20926-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This fixes error reporting for oneshot tests in xt/lei-auth-failure.t --- lib/PublicInbox/LEI.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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//