Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] Handle SIGQUIT signal #54510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function __construct(
$this->defaultCommand = 'list';
if (\defined('SIGINT') && SignalRegistry::isSupported()) {
$this->signalRegistry = new SignalRegistry();
$this->signalsToDispatchEvent = [\SIGINT, \SIGTERM, \SIGUSR1, \SIGUSR2];
$this->signalsToDispatchEvent = [\SIGINT, \SIGQUIT, \SIGTERM, \SIGUSR1, \SIGUSR2];
}
}

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

foreach ([\SIGINT, \SIGTERM] as $signal) {
foreach ([\SIGINT, \SIGQUIT, \SIGTERM] as $signal) {
$this->signalRegistry->register($signal, static fn () => shell_exec('stty '.$sttyMode));
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Messenger/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CHANGELOG
* Add option `redis_sentinel` as an alias for `sentinel_master`
* Add `--all` option to the `messenger:consume` command
* Add parameter `$jitter` to `MultiplierRetryStrategy` in order to randomize delay and prevent the thundering herd effect
* Add `SIGQUIT` signal among list of signals that gracefully shut down `messenger:consume` and `messenger:failed:retry` commands

7.0
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti

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

public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(
private EventDispatcherInterface $eventDispatcher,
private ?LoggerInterface $logger = null,
?PhpSerializer $phpSerializer = null,
private ?array $signals = null
private ?array $signals = null,
) {
parent::__construct($globalReceiverName, $failureTransports, $phpSerializer);
}
Expand Down Expand Up @@ -132,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

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

public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false
Expand Down
Loading