Skip to content

Commit

Permalink
allow some concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Aug 7, 2017
1 parent 1180e72 commit b2b56f6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions t/pod-valid.t
Expand Up @@ -9,6 +9,7 @@ Insure any text that isn't a code example has a space after each comma.
=end overview

my @files;
my $max-jobs = 3;

if @*ARGS {
@files = @*ARGS;
Expand All @@ -21,13 +22,21 @@ if @*ARGS {

plan +@files;

for @files -> $file {
sub test-it($job) {
ok !$job.exitcode, "{$job.command[*-1]} has valid Pod6"
}

my @jobs;
for @files -> $file {
my $p = Proc::Async.new($*EXECUTABLE-NAME, '--doc', $file);
$p.stdout.tap(-> $buf {});
$p.stderr.tap(-> $buf {});
my $r = await $p.start;
ok !$r.exitcode, "$file has valid POD6"
push @jobs: $p.start;
if +@jobs > $max-jobs {
test-it(await @jobs.shift);
}
}

for @jobs.map: {await $_} -> $r { test-it($r) }

# vim: expandtab shiftwidth=4 ft=perl6

0 comments on commit b2b56f6

Please sign in to comment.