From ba84abf920c754af3d7254b687e5f93f54c11923 Mon Sep 17 00:00:00 2001 From: mafei Date: Tue, 18 May 2021 09:36:38 +0800 Subject: [PATCH 1/3] Update BaseCommand.php this is to solve issue #1309 when executing command from the web instead of CLI --- src/Commands/BaseCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/BaseCommand.php b/src/Commands/BaseCommand.php index 799be556..6aa4c6aa 100644 --- a/src/Commands/BaseCommand.php +++ b/src/Commands/BaseCommand.php @@ -13,7 +13,7 @@ abstract class BaseCommand extends SignalAwareCommand public function __construct() { - if (PHP_OS_FAMILY !== 'Windows') { + if (PHP_OS_FAMILY !== 'Windows' && defined('SIGINT')) { $this->handlesSignals[] = SIGINT; } From bef9b7eabc76a2003ba17a8ab7d61f26d4403752 Mon Sep 17 00:00:00 2001 From: mafei Date: Tue, 25 May 2021 23:17:29 +0800 Subject: [PATCH 2/3] Update BaseCommand.php --- src/Commands/BaseCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Commands/BaseCommand.php b/src/Commands/BaseCommand.php index 6aa4c6aa..66639e66 100644 --- a/src/Commands/BaseCommand.php +++ b/src/Commands/BaseCommand.php @@ -13,7 +13,7 @@ abstract class BaseCommand extends SignalAwareCommand public function __construct() { - if (PHP_OS_FAMILY !== 'Windows' && defined('SIGINT')) { + if (PHP_OS_FAMILY !== 'Windows' && $this->runningInConsole() && defined('SIGINT')) { $this->handlesSignals[] = SIGINT; } @@ -26,4 +26,9 @@ public function run(InputInterface $input, OutputInterface $output): int return parent::run($input, $output); } + + protected functiin runningInConsole(): bool + { + return in_array(php_sapi_name(), ['cli', 'phpdbg']); + } } From 06fe799e8df9f7b6b041fe01a9882967afb687aa Mon Sep 17 00:00:00 2001 From: mafei Date: Fri, 28 May 2021 09:55:34 +0800 Subject: [PATCH 3/3] Update BaseCommand.php --- src/Commands/BaseCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/BaseCommand.php b/src/Commands/BaseCommand.php index 66639e66..f13ee8d0 100644 --- a/src/Commands/BaseCommand.php +++ b/src/Commands/BaseCommand.php @@ -27,7 +27,7 @@ public function run(InputInterface $input, OutputInterface $output): int return parent::run($input, $output); } - protected functiin runningInConsole(): bool + protected function runningInConsole(): bool { return in_array(php_sapi_name(), ['cli', 'phpdbg']); }