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-Status: No, score=-3.8 required=3.0 tests=ALL_TRUSTED,AWL,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 F2F4D1FA13 for ; Sat, 26 Dec 2020 10:16:24 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/4] extindex: enable autoflush on STDOUT/STDERR Date: Sat, 26 Dec 2020 10:16:22 +0000 Message-Id: <20201226101624.26061-3-e@80x24.org> In-Reply-To: <20201226101624.26061-1-e@80x24.org> References: <20201226101624.26061-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: With --watch, the output may be redirected to a pipe or socket which Perl may decide to buffer. Ensure Perl doesn't buffer these outputs since they can provide real-time status updates in response to signals or FS activity. --- script/public-inbox-extindex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/public-inbox-extindex b/script/public-inbox-extindex index 607baa3e..17986f60 100644 --- a/script/public-inbox-extindex +++ b/script/public-inbox-extindex @@ -33,7 +33,9 @@ GetOptions($opt, qw(verbose|v+ reindex rethread compact|c+ jobs|j=i or die $help; if ($opt->{help}) { print $help; exit 0 }; die "--jobs must be >= 0\n" if defined $opt->{jobs} && $opt->{jobs} < 0; - +require IO::Handle; +STDOUT->autoflush(1); +STDERR->autoflush(1); # require lazily to speed up --help my $eidx_dir = shift(@ARGV) // die "E: $help"; local $SIG{USR1} = 'IGNORE'; # to be overridden in eidx_sync