|
15 | 15 |
|
16 | 16 | use function getcwd;
|
17 | 17 | use function realpath;
|
18 |
| -use RuntimeException; |
19 | 18 | use function sprintf;
|
20 | 19 | use Symfony\Component\Console\Command\Command;
|
21 | 20 | use Symfony\Component\Console\Input\InputInterface;
|
22 | 21 | use Symfony\Component\Console\Logger\ConsoleLogger;
|
23 | 22 | use Symfony\Component\Console\Output\OutputInterface;
|
24 | 23 | use Symfony\Component\Console\Terminal;
|
25 | 24 | use Symfony\Component\DependencyInjection\ContainerInterface;
|
26 |
| -use Symfony\Component\Process\PhpExecutableFinder; |
27 |
| -use Symfony\Component\Process\Process; |
28 | 25 | use Webmozart\Assert\Assert;
|
29 | 26 | use Webmozarts\Console\Parallelization\ErrorHandler\ItemProcessingErrorHandler;
|
30 | 27 | use Webmozarts\Console\Parallelization\ErrorHandler\ItemProcessingErrorHandlerLogger;
|
31 | 28 | use Webmozarts\Console\Parallelization\ErrorHandler\ResetContainerErrorHandler;
|
32 | 29 | use Webmozarts\Console\Parallelization\Logger\DebugProgressBarFactory;
|
33 | 30 | use Webmozarts\Console\Parallelization\Logger\Logger;
|
34 | 31 | use Webmozarts\Console\Parallelization\Logger\StandardLogger;
|
| 32 | +use Webmozarts\Console\Parallelization\Process\PhpExecutableFinder; |
35 | 33 |
|
36 | 34 | /**
|
37 | 35 | * Adds parallelization capabilities to console commands.
|
@@ -229,9 +227,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
|
229 | 227 | fn (string $item, InputInterface $input, OutputInterface $output) => $this->runSingleCommand($item, $input, $output),
|
230 | 228 | fn (int $count) => $this->getItemName($count),
|
231 | 229 | $this->getConsolePath(),
|
232 |
| - self::detectPhpExecutable(), |
| 230 | + $this->getPhpExecutable(), |
233 | 231 | $this->getName(),
|
234 |
| - self::getWorkingDirectory(), |
| 232 | + $this->getWorkingDirectory(), |
235 | 233 | $this->getExtraEnvironmentVariables(),
|
236 | 234 | $this->getDefinition(),
|
237 | 235 | $this->createItemErrorHandler(),
|
@@ -325,23 +323,17 @@ private static function getProgressSymbol(): string
|
325 | 323 | }
|
326 | 324 |
|
327 | 325 | /**
|
328 |
| - * Detects the path of the PHP interpreter. |
| 326 | + * Returns the path of the PHP executable. |
329 | 327 | */
|
330 |
| - private static function detectPhpExecutable(): string |
| 328 | + private function getPhpExecutable(): string |
331 | 329 | {
|
332 |
| - $php = (new PhpExecutableFinder())->find(); |
333 |
| - |
334 |
| - if (false === $php) { |
335 |
| - throw new RuntimeException('Cannot find php executable'); |
336 |
| - } |
337 |
| - |
338 |
| - return $php; |
| 330 | + return PhpExecutableFinder::find(); |
339 | 331 | }
|
340 | 332 |
|
341 | 333 | /**
|
342 | 334 | * Returns the working directory for the child process.
|
343 | 335 | */
|
344 |
| - private static function getWorkingDirectory(): string |
| 336 | + private function getWorkingDirectory(): string |
345 | 337 | {
|
346 | 338 | return getcwd();
|
347 | 339 | }
|
|
0 commit comments