]> Sergey Matveev's repositories - public-inbox.git/commitdiff
extindex: enable autoflush on STDOUT/STDERR
authorEric Wong <e@80x24.org>
Sat, 26 Dec 2020 10:16:22 +0000 (10:16 +0000)
committerEric Wong <e@80x24.org>
Sun, 27 Dec 2020 09:30:33 +0000 (09:30 +0000)
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

index 607baa3e0ef785b3e8cd31d06f5449a55bc07352..17986f606e93f16872aa7e4df2d0ad72cad4fe59 100644 (file)
@@ -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