Subject: | colored doesn't reliably reset the color on STDERR |
Date: | Sat, 3 Jun 2017 13:00:27 +0200 |
To: | bug-Term-ANSIColor [...] rt.cpan.org |
From: | Andreas Schwarz <a.schwarz_dev [...] dntw.de> |
Subject: | colored doesn't reliably reset the color on STDERR |
To: | bug-Term-ANSIColor [...] rt.cpan.org |
From: | Andreas Schwarz <a.schwarz_dev [...] dntw.de> |
Term::ANSIcolor colored
If you print a colored String on STDOUT and want to print normal text on STDERR
in the next line, this text will be colored too (but not if you send normal text
to STDOUT before, also not if you send initial colored text to STDERR).
This also happens if you're using subroutines for printing.
I've tested this issue on following perl versions:
5.20.2-3+deb8u6 from debian jessie repository
This is perl 5, version 20, subversion 2 (v5.20.2)
built for x86_64-linux-gnu-thread-multi
5.24.1-2 from debian stretch repository
This is perl 5, version 24, subversion 1 (v5.24.1)
built for x86_64-linux-gnu-thread-multi
5.26.0 from source build on debian jessie
This is perl 5, version 26, subversion 0 (v5.26.0)
built for x86_64-linux
5.27.0 from source build on debian jessie
This is perl 5, version 27, subversion 0 (v5.27.0)
built for x86_64-linux
demonstration code -------------------------------------------------------------
#!/usr/bin/perl
use Term::ANSIColor;
print STDOUT "normal STDOUT text\n";
print STDERR "normal STDERR text\n";
# start with STDERR (all fine) ----------------------------
print STDERR colored("red STDERR text\n", 'red');
print STDERR "should normal STDERR text\n";
print STDOUT "should normal STDOUT text\n";
# change the order
print STDERR colored("red STDERR text\n", 'red');
print STDOUT "should normal STDOUT text\n";
print STDERR "should normal STDERR text\n";
# start with STDOUT ---------------------------------------
print STDOUT colored("red STDOUT text\n", 'red');
print STDERR "should normal STDERR text\n"; # but isn't
print STDOUT "should normal STDOUT text\n";
# change the order
print STDOUT colored("red STDOUT text\n", 'red');
print STDOUT "should normal STDOUT text\n";
print STDERR "should normal STDERR text\n"; # now it is
--------------------------------------------------------------------------------
best regards
Andreas Schwarz
Message body is not shown because sender requested not to inline it.
Message body not shown because it is not plain text.