Skip to content

Commit

Permalink
fixed several compatibility issues with windows and php-cgi
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsgsDesign authored Oct 11, 2021
1 parent 72bd03a commit 3853293
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Scheduling.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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());
Expand Down

0 comments on commit 3853293

Please sign in to comment.