Supported Versions: PHP 7 >= 7.1.0, PHP 8
Enable/disable asynchronous signal handling or return the old setting
<?php pcntl_async_signals(?bool $enable = null): bool
<?php protected function listenForSignals()
{
pcntl_async_signals(true);
pcntl_signal(SIGQUIT, fn () => $this->shouldQuit = true);
pcntl_signal(SIGTERM, fn () => $this->shouldQuit = true);
<?php if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
@mkdir($directory, 0777, true);
if ($realDir = realpath($directory)) {
pcntl_async_signals(true);
pcntl_signal(SIGINT, function () use ($realDir) {
$fs = new Filesystem();
$fs->removeDirectory($realDir);
<?php protected function execute(InputInterface $input, OutputInterface $output)
{
if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
pcntl_async_signals(true);
pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
<?php if (!$shutdownRegistered) {
if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
pcntl_async_signals(true);
pcntl_signal(SIGINT, function ($sig) {
exit(130);
});
<?php $prevHandler = null;
$windowsHandler = null;
if ($handleInterruptsUnix) {
pcntl_async_signals(true);
$prevHandler = pcntl_signal_get_handler(SIGINT);
pcntl_signal(SIGINT, function ($sig) use ($runCleanup, $prevHandler, $io) {
$io->writeError('Received SIGINT, aborting', true, IOInterface::DEBUG);
<?php if ($this->pcntl && !$this->pcntlPoll) {
\pcntl_async_signals(true);
}
}