You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ($commandSignals || null !== $this->dispatcher) {
1007
-
if (!$this->signalRegistry) {
1008
-
thrownewRuntimeException('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.');
if ($commandSignals || $this->dispatcher && $this->signalsToDispatchEvent) {
1005
+
if (!$this->signalRegistry) {
1006
+
thrownewRuntimeException('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.');
1007
+
}
1010
1008
1011
-
if (Terminal::hasSttyAvailable()) {
1012
-
$sttyMode = shell_exec('stty -g');
1009
+
if (Terminal::hasSttyAvailable()) {
1010
+
$sttyMode = shell_exec('stty -g');
1013
1011
1014
-
foreach ([\SIGINT, \SIGTERM] as$signal) {
1015
-
$this->signalRegistry->register($signal, staticfunction () use ($sttyMode) {
trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', get_debug_type($command));
1032
+
$exitCode = 0;
1033
+
}
1034
+
}
1035
+
1036
+
if (false !== $exitCode) {
1037
+
exit($exitCode);
1038
+
}
1028
1039
});
1029
1040
}
1041
+
1042
+
// then we register command signals, but not if already handled after the dispatcher
$this->signalRegistry->register($signal, function (int$signal) use ($command): void {
1048
+
$exitCode = $command->handleSignal($signal);
1049
+
// BC layer for Symfony <= 5
1050
+
if (null === $exitCode) {
1051
+
trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', get_debug_type($command));
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ CHANGELOG
4
4
6.3
5
5
---
6
6
7
-
*Remove `exit` call in `Application` signal handlers. Commands will no longer be automatically interrupted after receiving signal other than `SIGUSR1` or `SIGUSR2`
7
+
*Add support for choosing exit code while handling signal, or to not exit at all
8
8
* Add `ProgressBar::setPlaceholderFormatter` to set a placeholder attached to a instance, instead of being global.
0 commit comments