commit: cc4183ba633280f05fe6bfbe44323dc00ffadacb Author: Kerin Millar <kfm <AT> plushkava <DOT> net> AuthorDate: Sat Jan 10 00:35:48 2026 +0000 Commit: Kerin Millar <kfm <AT> plushkava <DOT> net> CommitDate: Sat Jan 10 00:37:10 2026 +0000 URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=cc4183ba
Avoid flushing STDOUT in print_warning() Presently, if STDERR is found to be a terminal by the print_warning subroutine(), STDOUT is forcibly flushed before printing any coloured output to STDERR. Instead, configure the Term::ANSIColor module to position the SGR reset sequence just before the <newline> characters, if any. Doing so saves a syscall and seems better suited to the way in which locale-gen(8) operates. Link: https://perldoc.perl.org/Term::ANSIColor#RESTRICTIONS Signed-off-by: Kerin Millar <kfm <AT> plushkava.net> locale-gen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale-gen b/locale-gen index daa3067..905fdef 100644 --- a/locale-gen +++ b/locale-gen @@ -744,7 +744,7 @@ sub can_run ($bin) { sub print_warning ($warning) { if (-t 2) { - *STDOUT->flush; + local $Term::ANSIColor::EACHLINE = "\n"; print STDERR colored($warning, 'bold yellow'); } else { print STDERR $warning;
