Skip to content

Commit 3785369

Browse files
tucksauncmgmyr
andauthored
Prevent the runner to swallow its threads error (#641)
* Prevent the runner to swallow its threads error This should fix #609, or at least make the initial error bubble up allowing the user to fix it or report it properly * format --------- Co-authored-by: Chris Gmyr <cmgmyr@gmail.com>
1 parent 63e9d3f commit 3785369

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Domain/Runner.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Symfony\Component\Console\Helper\ProgressBar;
1414
use Symfony\Component\Console\Output\OutputInterface;
1515
use Symfony\Component\Finder\SplFileInfo;
16+
use Symfony\Component\Process\Exception\ProcessFailedException;
1617
use Symfony\Component\Process\Process;
1718

1819
/**
@@ -151,11 +152,17 @@ function (SplFileInfo $file): void {
151152

152153
while ($runningProcesses !== []) {
153154
foreach ($runningProcesses as $i => $runningProcess) {
154-
if (! $runningProcess->isRunning()) {
155-
$progressBar->advance(\count($filesByThread[$i]));
156-
unset($runningProcesses[$i]);
155+
if ($runningProcess->isRunning()) {
156+
usleep(1000);
157+
continue;
157158
}
158-
usleep(1000);
159+
160+
if (! $runningProcess->isSuccessful()) {
161+
throw new ProcessFailedException($runningProcess);
162+
}
163+
164+
$progressBar->advance(\count($filesByThread[$i]));
165+
unset($runningProcesses[$i]);
159166
}
160167
}
161168

0 commit comments

Comments
 (0)