From 5c3f6e070d9a28bc980c64e43ccd025a8735e725 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 28 Oct 2024 16:30:35 +0100 Subject: [PATCH] Remove SignalHandler from Application to fix issues handling ctrl-C inside prompts Fixes #12106 --- src/Composer/Console/Application.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index dcf777f83..2b9922337 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -19,7 +19,6 @@ use Composer\Util\Platform; use Composer\Util\Silencer; use LogicException; use RuntimeException; -use Seld\Signal\SignalHandler; use Symfony\Component\Console\Application as BaseApplication; use Symfony\Component\Console\Exception\CommandNotFoundException; use Symfony\Component\Console\Helper\HelperSet; @@ -84,9 +83,6 @@ class Application extends BaseApplication */ private $initialWorkingDirectory; - /** @var SignalHandler */ - private $signalHandler; - public function __construct(string $name = 'Composer', string $version = '') { if (method_exists($this, 'setCatchErrors')) { @@ -108,12 +104,6 @@ class Application extends BaseApplication $this->io = new NullIO(); - $this->signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) { - $this->io->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG); - - $handler->exitWithLastSignal(); - }); - if (!$shutdownRegistered) { $shutdownRegistered = true; @@ -135,7 +125,6 @@ class Application extends BaseApplication public function __destruct() { - $this->signalHandler->unregister(); } public function run(?InputInterface $input = null, ?OutputInterface $output = null): int