diff --git a/composer.json b/composer.json index 5b3b35ec..d954c098 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,9 @@ "mockery/mockery": "^1.3.3", "phpunit/phpunit": "^8.0|^9.5.8" }, + "suggest": { + "ext-pcntl": "Recommended when running the Inertia SSR server via the `inertia:start-ssr` artisan command." + }, "extra": { "laravel": { "providers": [ diff --git a/src/Commands/StartSsr.php b/src/Commands/StartSsr.php index 18efdee7..e2b5d84b 100644 --- a/src/Commands/StartSsr.php +++ b/src/Commands/StartSsr.php @@ -56,13 +56,15 @@ public function handle(): int $process->setTimeout(null); $process->start(); - $stop = function () use ($process) { - $process->stop(); - }; - pcntl_async_signals(true); - pcntl_signal(SIGINT, $stop); - pcntl_signal(SIGQUIT, $stop); - pcntl_signal(SIGTERM, $stop); + if (extension_loaded('pcntl')) { + $stop = function () use ($process) { + $process->stop(); + }; + pcntl_async_signals(true); + pcntl_signal(SIGINT, $stop); + pcntl_signal(SIGQUIT, $stop); + pcntl_signal(SIGTERM, $stop); + } foreach ($process as $type => $data) { if ($process::OUT === $type) {