Skip to content

Commit 6088728

Browse files
committed
bug #38602 [Console] Fix signal management (chalasr)
This PR was merged into the 5.x branch. Discussion ---------- [Console] Fix signal management | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Missed in #38589 Commits ------- 36e41b8 [Console] Fix Application::getSignalRegistry() retval
2 parents 5ca43b8 + 36e41b8 commit 6088728

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Symfony/Component/Console/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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy