Skip to content

Commit b61edc9

Browse files
committed
[Console] Fix Application::getSignalRegistry() retval
1 parent bcc596a commit b61edc9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Application.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ public function setCommandLoader(CommandLoaderInterface $commandLoader)
110110

111111
public function getSignalRegistry(): SignalRegistry
112112
{
113+
if (!$this->signalRegistry) {
114+
throw new RuntimeException('Signals are not supported. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
115+
}
116+
113117
return $this->signalRegistry;
114118
}
115119

@@ -282,7 +286,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
282286
$command = $this->find($alternative);
283287
}
284288

285-
if ($this->dispatcher) {
289+
if ($this->dispatcher && $this->signalRegistry) {
286290
foreach ($this->signalsToDispatchEvent as $signal) {
287291
$event = new ConsoleSignalEvent($command, $input, $output, $signal);
288292

@@ -954,7 +958,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
954958
}
955959

956960
if ($command instanceof SignalableCommandInterface) {
957-
if (!$this->signalsToDispatchEvent) {
961+
if (!$this->signalRegistry) {
958962
throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
959963
}
960964
foreach ($command->getSubscribedSignals() as $signal) {

0 commit comments

Comments
 (0)