|
24 | 24 | use Symfony\Component\Console\Exception\ExceptionInterface;
|
25 | 25 | use Symfony\Component\Console\Exception\LogicException;
|
26 | 26 | use Symfony\Component\Console\Exception\NamespaceNotFoundException;
|
| 27 | +use Symfony\Component\Console\Exception\RuntimeException; |
27 | 28 | use Symfony\Component\Console\Formatter\OutputFormatter;
|
28 | 29 | use Symfony\Component\Console\Helper\DebugFormatterHelper;
|
29 | 30 | use Symfony\Component\Console\Helper\FormatterHelper;
|
@@ -88,8 +89,8 @@ public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN
|
88 | 89 | $this->version = $version;
|
89 | 90 | $this->terminal = new Terminal();
|
90 | 91 | $this->defaultCommand = 'list';
|
91 |
| - $this->signalRegistry = new SignalRegistry(); |
92 |
| - if (\defined('SIGINT')) { |
| 92 | + if (\defined('SIGINT') && SignalRegistry::isSupported()) { |
| 93 | + $this->signalRegistry = new SignalRegistry(); |
93 | 94 | $this->signalsToDispatchEvent = [\SIGINT, \SIGTERM, \SIGUSR1, \SIGUSR2];
|
94 | 95 | }
|
95 | 96 | }
|
@@ -953,6 +954,9 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
|
953 | 954 | }
|
954 | 955 |
|
955 | 956 | if ($command instanceof SignalableCommandInterface) {
|
| 957 | + if (!$this->signalsToDispatchEvent) { |
| 958 | + 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.'); |
| 959 | + } |
956 | 960 | foreach ($command->getSubscribedSignals() as $signal) {
|
957 | 961 | $this->signalRegistry->register($signal, [$command, 'handleSignal']);
|
958 | 962 | }
|
|
0 commit comments