diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index 6ef8521ca2f..b3ee800663b 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -7,6 +7,7 @@ use GuzzleHttp\Client as HttpClient; use GuzzleHttp\ClientInterface as HttpClientInterface; use GuzzleHttp\Exception\TransferException; +use Illuminate\Console\Application; use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Debug\ExceptionHandler; use Illuminate\Contracts\Mail\Mailer; @@ -811,7 +812,8 @@ public function mutexName() return $mutexNameResolver($this); } - return 'framework'.DIRECTORY_SEPARATOR.'schedule-'.sha1($this->expression.$this->command); + return 'framework'.DIRECTORY_SEPARATOR.'schedule-'. + sha1($this->expression.$this->normalizeCommand($this->command ?? '')); } /** @@ -838,4 +840,21 @@ protected function removeMutex() $this->mutex->forget($this); } } + + /** + * Format the given command string with a normalized PHP binary path. + * + * @param string $command + * @return string + */ + public static function normalizeCommand($command) + { + return str_replace([ + Application::phpBinary(), + Application::artisanBinary(), + ], [ + 'php', + preg_replace("#['\"]#", '', Application::artisanBinary()), + ], $command); + } } diff --git a/src/Illuminate/Console/Scheduling/ScheduleListCommand.php b/src/Illuminate/Console/Scheduling/ScheduleListCommand.php index cf42dc795f0..97845ad8beb 100644 --- a/src/Illuminate/Console/Scheduling/ScheduleListCommand.php +++ b/src/Illuminate/Console/Scheduling/ScheduleListCommand.php @@ -5,7 +5,6 @@ use Closure; use Cron\CronExpression; use DateTimeZone; -use Illuminate\Console\Application; use Illuminate\Console\Command; use Illuminate\Support\Carbon; use Illuminate\Support\Collection; @@ -123,10 +122,7 @@ private function listEvent($event, $terminalWidth, $expressionSpacing, $repeatEx $description = $event->description ?? ''; if (! $this->output->isVerbose()) { - $command = str_replace([Application::phpBinary(), Application::artisanBinary()], [ - 'php', - preg_replace("#['\"]#", '', Application::artisanBinary()), - ], $command); + $command = $event->normalizeCommand($command); } if ($event instanceof CallbackEvent) {