From 1fa6f4c83ca381019451488fd2243eaed6dd389b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 1 Jul 2020 11:37:38 +0200 Subject: [PATCH] Add a default signal handler to avoid having the SIGINTs ignored, fixes #9027 --- src/Composer/Console/Application.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 4160a69ac..622938476 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -81,6 +81,13 @@ class Application extends BaseApplication } if (!$shutdownRegistered) { + if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) { + pcntl_async_signals(true); + pcntl_signal(SIGINT, function ($sig) { + exit(130); + }); + } + $shutdownRegistered = true; register_shutdown_function(function () {