Several additions and bug fixes.
diff --git a/tools/winapi/output.pm b/tools/winapi/output.pm
index a085f95..6234d6c 100644
--- a/tools/winapi/output.pm
+++ b/tools/winapi/output.pm
@@ -23,6 +23,9 @@
use strict;
+my $stdout_isatty = -t STDOUT;
+my $stderr_isatty = -t STDERR;
+
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
@@ -51,7 +54,7 @@
$$progress_count++;
- if($$progress_count > 0 && $$progress) {
+ if($$progress_count > 0 && $$progress && $stderr_isatty) {
print STDERR $$progress;
$$last_progress = $$progress;
}
@@ -65,7 +68,7 @@
$$progress_count--;
- if($$last_progress) {
+ if($$last_progress && $stderr_isatty) {
my $message;
for (1..length($$last_progress)) {
$message .= " ";
@@ -124,9 +127,9 @@
my $prefix = \${$self->{PREFIX}};
- $self->hide_progress;
+ $self->hide_progress if $stdout_isatty;
print $$prefix . $message;
- $self->show_progress;
+ $self->show_progress if $stdout_isatty;
}
1;