Skip to content

Commit

Permalink
Merge pull request #20 from ZsgsDesign/master
Browse files Browse the repository at this point in the history
fixed several compatibility issues with windows and php-cgi, see #15
  • Loading branch information
jxlwqq authored Oct 11, 2021
2 parents 72bd03a + 3853293 commit 84483c6
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 84483c6

Please sign in to comment.