pcntl_signal_get_handler

Supported Versions: PHP 7 >= 7.1.0, PHP 8
Get the current handler for specified signal
<?php pcntl_signal_get_handler(int $signal): callable|int
<?php     protected function initializeSignal($signal)

    {

        return is_callable($existingHandler = pcntl_signal_get_handler($signal))

            ? [$existingHandler]

            : null;

    }
<?php         $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);

                $runCleanup();