diff --git a/src/Scheduling.php b/src/Scheduling.php index d0bae5f..db21d1a 100644 --- a/src/Scheduling.php +++ b/src/Scheduling.php @@ -75,6 +75,15 @@ protected function formatTask($event) ]; } + if (PHP_OS_FAMILY === 'Windows' && Str::contains($event->command, '"artisan"')) { + $exploded = explode(' ', $event->command); + + return [ + 'type' => 'artisan', + 'name' => 'artisan '.implode(' ', array_slice($exploded, 2)), + ]; + } + return [ 'type' => 'command', 'name' => $event->command, @@ -95,6 +104,10 @@ public function runTask($id) /** @var \Illuminate\Console\Scheduling\Event $event */ $event = $this->getKernelEvents()[$id - 1]; + if (PHP_OS_FAMILY === 'Windows') { + $event->command = Str::of($event->command)->replace('php-cgi.exe', 'php.exe'); + } + $event->sendOutputTo($this->getOutputTo()); $event->run(app());