diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm index 5062811..bb3f57f 100644 --- a/modules/ksb/Application.pm +++ b/modules/ksb/Application.pm @@ -1371,10 +1371,10 @@ sub _handle_build $ctx->unsetPersistentOption('global', 'resume-list'); - my $outfile = pretending() ? undef + my $outfile = pretending() ? '/dev/null' : $ctx->getLogDir() . '/build-status'; - open (STATUS_FILE, '>', $outfile // '/dev/null') or do { + open (STATUS_FILE, '>', $outfile) or do { error (<releaseTTY(); + $statusViewer->releaseTTY("\t$message done"); return; } diff --git a/modules/ksb/Debug.pm b/modules/ksb/Debug.pm index 0704bc9..d3ad75b 100644 --- a/modules/ksb/Debug.pm +++ b/modules/ksb/Debug.pm @@ -1,4 +1,4 @@ -package ksb::Debug; +package ksb::Debug 0.20; # Debugging routines and constants for use with kdesrc-build @@ -6,11 +6,10 @@ use strict; use warnings; use 5.014; -our $VERSION = '0.10'; - use Exporter qw(import); # Steal Exporter's import method our @EXPORT = qw(debug pretending debugging whisper note info warning error pretend); +our @EXPORT_OK = qw(colorize); # Debugging level constants. use constant { diff --git a/modules/ksb/StatusView.pm b/modules/ksb/StatusView.pm index df5d92d..6f16cb9 100644 --- a/modules/ksb/StatusView.pm +++ b/modules/ksb/StatusView.pm @@ -10,7 +10,7 @@ use strict; use warnings; use 5.014; -use ksb::Debug; +use ksb::Debug 0.20 qw(colorize); use IO::Handle; @@ -68,7 +68,7 @@ sub update ); } else { - $msg = $self->{status} . + $msg = $self->{status} . ' ' . substr($spinner, $self->{cur_progress} % length($spinner), 1); } @@ -89,6 +89,8 @@ sub _clearLineAndUpdate { my $msg = shift; + $msg = colorize($msg); + # Give escape sequence to return to column 1 and clear the entire line # Then print message and return to column 1 again in case somewhere else # uses the tty. diff --git a/modules/ksb/Util.pm b/modules/ksb/Util.pm index a69280f..db01484 100644 --- a/modules/ksb/Util.pm +++ b/modules/ksb/Util.pm @@ -443,6 +443,12 @@ sub log_command debug ("log_command(): Module $module, Command: ", join(' ', @command)); + if (pretending()) + { + pretend ("\tWould have run g['" . join ("' '", @command) . "'"); + return 0; + } + # Fork a child, with its stdout connected to CHILD. my $pid = open(CHILD, '-|'); if ($pid) @@ -482,12 +488,6 @@ sub log_command # Apply altered environment variables. $module->buildContext()->commitEnvironmentChanges(); - if (pretending()) - { - pretend ("\tWould have run g['" . join ("' '", @command) . "'"); - POSIX::_exit(0); - } - my $logdir = $module->getLogDir(); if (!$logdir || ! -e $logdir) {