dougm 01/12/20 09:30:54
Modified: perl-framework/Apache-Test/lib/Apache TestConfig.pm
TestServer.pm TestTrace.pm
Log:
turn of color unless STDOUT is open to a tty
Revision Changes Path
1.116 +1 -0
httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm
Index: TestConfig.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -r1.115 -r1.116
--- TestConfig.pm 2001/12/20 16:04:17 1.115
+++ TestConfig.pm 2001/12/20 17:30:54 1.116
@@ -7,6 +7,7 @@
use constant CYGWIN => $^O eq 'cygwin';
use constant NETWARE => $^O eq 'NetWare';
use constant WINFU => WIN32 || CYGWIN || NETWARE;
+use constant COLOR => ! $ENV{APACHE_TEST_NO_COLOR} && -t STDOUT;
use Symbol ();
use File::Copy ();
1.46 +5 -3
httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm
Index: TestServer.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- TestServer.pm 2001/12/20 03:51:11 1.45
+++ TestServer.pm 2001/12/20 17:30:54 1.46
@@ -11,8 +11,10 @@
use Apache::TestConfig ();
use Apache::TestRequest ();
-my $CTRL_M = $ENV{APACHE_TEST_NO_COLOR} ? "\n" : "\r";
+use constant COLOR => Apache::TestConfig::COLOR;
+my $CTRL_M = COLOR ? "\r" : "\n";
+
# some debuggers use the same syntax as others, so we reuse the same
# code by using the following mapping
my %debuggers = (
@@ -435,7 +437,7 @@
my $preamble = "${CTRL_M}waiting for server to start: ";
while (1) {
my $delta = time - $start_time;
- unless ($ENV{APACHE_TEST_NO_COLOR}) {
+ if (COLOR) {
print $preamble, sprintf "%02d:%02d", (gmtime $delta)[1,0];
}
sleep 1;
@@ -495,7 +497,7 @@
my $preamble = "${CTRL_M}still waiting for server to warm up: ";
while (1) {
my $delta = time - $start_time;
- unless ($ENV{APACHE_TEST_NO_COLOR}) {
+ if (COLOR) {
print $preamble, sprintf "%02d:%02d", (gmtime $delta)[1,0];
}
sleep $sleep_interval;
1.10 +3 -1
httpd-test/perl-framework/Apache-Test/lib/Apache/TestTrace.pm
Index: TestTrace.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestTrace.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestTrace.pm 2001/12/14 18:43:30 1.9
+++ TestTrace.pm 2001/12/20 17:30:54 1.10
@@ -3,6 +3,8 @@
use strict;
use warnings FATAL => 'all';
+use Apache::TestConfig ();
+
use Exporter ();
use vars qw(@Levels @Utils @ISA @EXPORT $VERSION $Level $LogFH);
@@ -24,7 +26,7 @@
use constant HAS_COLOR => eval {
#XXX: another way to color WINFU terms?
!(grep { $^O eq $_ } qw(MSWin32 cygwin NetWare)) and
- !$ENV{APACHE_TEST_NO_COLOR} and require Term::ANSIColor;
+ Apache::TestConfig::COLOR and require Term::ANSIColor;
};
use constant HAS_DUMPER => eval { require Data::Dumper; };