Skip to content

Commit 011181f

Browse files
committed
minor #17805 [Console] Remove exit() call in last SignalHandler (alexandre-daubois)
This PR was merged into the 6.3 branch. Discussion ---------- [Console] Remove exit() call in last SignalHandler Fixes #17544 Commits ------- aeb0ccc [Console] Remove exit() call in last SignalHandler
2 parents aece56c + aeb0ccc commit 011181f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

components/console/events.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ Listeners receive a
174174
use Symfony\Component\Console\Event\ConsoleSignalEvent;
175175

176176
$dispatcher->addListener(ConsoleEvents::SIGNAL, function (ConsoleSignalEvent $event) {
177-
177+
178178
// gets the signal number
179179
$signal = $event->getHandlingSignal();
180-
180+
181181
if (\SIGINT === $signal) {
182182
echo "bye bye!";
183183
}
@@ -218,6 +218,18 @@ handle signals themselves. To do so, implement the
218218
}
219219
}
220220

221+
It is your responsibility to handle signals that are relevant to you (even
222+
``SIGKILL``, ``SIGTERM``, etc). This allows you to ignore them or do tasks
223+
before terminating the process for example. This behavior is intended, as
224+
it leaves more flexibility to developers to handle each type of signal the
225+
way they want to.
226+
227+
.. deprecated:: 6.3
228+
229+
In Symfony versions previous to 6.3, all signals (except from ``SIGUSR1`` and
230+
``SIGUSR2``) would terminate the script by calling ``exit(0)``. From Symfony 6.3,
231+
no more signal is automatically calling ``exit(0)``.
232+
221233
.. _`reserved exit codes`: https://www.tldp.org/LDP/abs/html/exitcodes.html
222234
.. _`Signals`: https://en.wikipedia.org/wiki/Signal_(IPC)
223235
.. _`constants of the PCNTL PHP extension`: https://www.php.net/manual/en/pcntl.constants.php

0 commit comments

Comments
 (0)