From df2beb5fd86950466ad64e260b26217775b54b2f Mon Sep 17 00:00:00 2001 From: Rodrigo Pedra Brum Date: Mon, 16 Sep 2024 14:02:56 -0300 Subject: [PATCH] use Console/Application::formatCommandString() --- src/Illuminate/Concurrency/ProcessDriver.php | 33 ++------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/src/Illuminate/Concurrency/ProcessDriver.php b/src/Illuminate/Concurrency/ProcessDriver.php index 9d82e75bc96b..8ba3345f9006 100644 --- a/src/Illuminate/Concurrency/ProcessDriver.php +++ b/src/Illuminate/Concurrency/ProcessDriver.php @@ -3,14 +3,13 @@ namespace Illuminate\Concurrency; use Closure; +use Illuminate\Console\Application; use Illuminate\Contracts\Concurrency\Driver; use Illuminate\Foundation\Defer\DeferredCallback; use Illuminate\Process\Factory as ProcessFactory; use Illuminate\Process\Pool; use Illuminate\Support\Arr; -use Illuminate\Support\ProcessUtils; use Laravel\SerializableClosure\SerializableClosure; -use Symfony\Component\Process\PhpExecutableFinder; class ProcessDriver implements Driver { @@ -27,7 +26,7 @@ public function __construct(protected ProcessFactory $processFactory) */ public function run(Closure|array $tasks): array { - $command = $this->buildCommand(); + $command = Application::formatCommandString('invoke-serialized-closure'); $results = $this->processFactory->pool(function (Pool $pool) use ($tasks, $command) { foreach (Arr::wrap($tasks) as $task) { @@ -55,7 +54,7 @@ public function run(Closure|array $tasks): array */ public function defer(Closure|array $tasks): DeferredCallback { - $command = $this->buildCommand(); + $command = Application::formatCommandString('invoke-serialized-closure'); return defer(function () use ($tasks, $command) { foreach (Arr::wrap($tasks) as $task) { @@ -65,30 +64,4 @@ public function defer(Closure|array $tasks): DeferredCallback } }); } - - /** - * Get the PHP binary. - */ - protected function phpBinary(): string - { - return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false) ?: 'php'); - } - - /** - * Get the Artisan binary. - */ - protected function artisanBinary(): string - { - return ProcessUtils::escapeArgument(defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'); - } - - /** - * Build the command string. - * - * @return string - */ - protected function buildCommand(): string - { - return sprintf('%s %s invoke-serialized-closure', $this->phpBinary(), $this->artisanBinary()); - } }