8000 [Console] Handle SIGQUIT signal · symfony/symfony@12c1bf0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 12c1bf0

Browse files
committed
[Console] Handle SIGQUIT signal
As both PHP-FPM and NGINX use SIGQUIT for graceful shutdown, I believe it's necessary PHP applications should also support it. It's especially important in cases where you run PHP application in container running php/nginx image, since they override shutdown signal that docker uses to SIGQUIT, see nginx/docker-nginx@3fb70dd
1 parent 9549cc2 commit 12c1bf0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function __construct(
9797
$this->defaultCommand = 'list';
9898
if (\defined('SIGINT') && SignalRegistry::isSupported()) {
9999
$this->signalRegistry = new SignalRegistry();
100-
$this->signalsToDispatchEvent = [\SIGINT, \SIGTERM, \SIGUSR1, \SIGUSR2];
100+
$this->signalsToDispatchEvent = [\SIGINT, \SIGQUIT, \SIGTERM, \SIGUSR1, \SIGUSR2];
101101
}
102102
}
103103

@@ -984,7 +984,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
984984
if (Terminal::hasSttyAvailable()) {
985985
$sttyMode = shell_exec('stty -g');
986986

987-
foreach ([\SIGINT, \SIGTERM] as $signal) {
987+
foreach ([\SIGINT, \SIGQUIT, \SIGTERM] as $signal) {
988988
$this->signalRegistry->register($signal, static fn () => shell_exec('stty '.$sttyMode));
989989
}
990990
}

src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
264264

265265
public function getSubscribedSignals(): array
266266
{
267-
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT] : []);
267+
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT, \SIGQUIT] : []);
268268
}
269269

270270
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false

src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
132132

133133
public function getSubscribedSignals(): array
134134
{
135-
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT] : []);
135+
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT, \SIGQUIT] : []);
136136
}
137137

138138
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false

0 commit comments

Comments
 (0)
0