Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Print output as it's happening #4

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/Test/Smoke/Smoker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ our $VERSION = '0.046';
use Config;
use Cwd;
use File::Spec::Functions qw( :DEFAULT abs2rel rel2abs );
use Capture::Tiny 'capture';
use Capture::Tiny 'capture', 'tee';
use Test::Smoke::LogMixin;
use Test::Smoke::Util qw( get_smoked_Config skip_filter );

Expand Down Expand Up @@ -761,6 +761,8 @@ sub _run_harness3_target {
my $file;
my $found = 0;
while ( $line = <$tst> ) {
print STDOUT $line;

#$self->log_debug($line);

# This line with timings only has to be logged to .out.
Expand Down Expand Up @@ -834,6 +836,9 @@ sub _run_harness3_target {
}

my @dump = <$tst>; # Read trailing output from pipe
for my $line (@dump) {
print STDOUT $line;
}

close $tst or do {
my $error = $! || ( $? >> 8);
Expand Down Expand Up @@ -1196,8 +1201,7 @@ sub _run {
$self->log_debug("[$command]");
defined $sub and return &$sub( $command, @args );

my ( $out, $err, $res ) = capture { system $command };
$self->log($err) if $err;
my ( $out, $err, $res ) = tee { system $command };
$self->{_run_exit} = $res >> 8;
return wantarray ? split /(\r\n|\r|\n)/, $out : $out;
}
Expand Down