Skip to content

Commit

Permalink
Prevent the runner to swallow its threads error
Browse files Browse the repository at this point in the history
This should fix #609, or at least make the initial error bubble up allowing the user to fix it or report it properly
  • Loading branch information
tucksaun authored and cmgmyr committed Sep 28, 2023
1 parent 63e9d3f commit 77ba1c5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Domain/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;

/**
Expand Down Expand Up @@ -151,11 +152,17 @@ function (SplFileInfo $file): void {

while ($runningProcesses !== []) {
foreach ($runningProcesses as $i => $runningProcess) {
if (! $runningProcess->isRunning()) {
$progressBar->advance(\count($filesByThread[$i]));
unset($runningProcesses[$i]);
if ($runningProcess->isRunning()) {
usleep(1000);
continue;
}
usleep(1000);

if (!$runningProcess->isSuccessful()) {

Check failure on line 160 in src/Domain/Runner.php

View workflow job for this annotation

GitHub Actions / 7.4 - prefer-stable

* [Space after not] Expected 1 space(s) after NOT operator; 0 found
throw new ProcessFailedException($runningProcess);
}

$progressBar->advance(\count($filesByThread[$i]));
unset($runningProcesses[$i]);
}
}

Expand Down

0 comments on commit 77ba1c5

Please sign in to comment.