From f1a2bd30f2e78ef2c867124d1985303c995c656e Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Fri, 28 Apr 2023 15:49:45 +0100 Subject: [PATCH 1/3] Ability to set default for --isolated option --- src/Illuminate/Console/Command.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Command.php b/src/Illuminate/Console/Command.php index 4ae96d68d97a..036cc63c81a2 100755 --- a/src/Illuminate/Console/Command.php +++ b/src/Illuminate/Console/Command.php @@ -61,6 +61,13 @@ class Command extends SymfonyCommand */ protected $hidden = false; + /** + * Indicates whether only one instance of the command can run at any given time. + * + * @var bool + */ + protected $isolated = false; + /** * The console command name aliases. * @@ -140,7 +147,7 @@ protected function configureIsolation() null, InputOption::VALUE_OPTIONAL, 'Do not run the command if another instance of the command is already running', - false + $this->isolated )); } From c3977a8a33b114ac42ee75fc1a93e3e37349e70c Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Fri, 28 Apr 2023 15:58:59 +0100 Subject: [PATCH 2/3] set default exit code --- src/Illuminate/Console/Command.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Command.php b/src/Illuminate/Console/Command.php index 036cc63c81a2..3f592a5b6b36 100755 --- a/src/Illuminate/Console/Command.php +++ b/src/Illuminate/Console/Command.php @@ -68,6 +68,13 @@ class Command extends SymfonyCommand */ protected $isolated = false; + /** + * The default exit code for isolated commands. + * + * @var int + */ + protected $isolatedCommandExitCode = self::SUCCESS; + /** * The console command name aliases. * @@ -192,7 +199,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return (int) (is_numeric($this->option('isolated')) ? $this->option('isolated') - : self::SUCCESS); + : $this->isolatedCommandExitCode); } $method = method_exists($this, 'handle') ? 'handle' : '__invoke'; From 4feb63d6e3717f9408e1dd633b3dc4d930748682 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 1 May 2023 09:05:08 -0700 Subject: [PATCH 3/3] Update Command.php --- src/Illuminate/Console/Command.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Console/Command.php b/src/Illuminate/Console/Command.php index 3f592a5b6b36..4d27527b9245 100755 --- a/src/Illuminate/Console/Command.php +++ b/src/Illuminate/Console/Command.php @@ -73,7 +73,7 @@ class Command extends SymfonyCommand * * @var int */ - protected $isolatedCommandExitCode = self::SUCCESS; + protected $isolatedExitCode = self::SUCCESS; /** * The console command name aliases. @@ -199,7 +199,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return (int) (is_numeric($this->option('isolated')) ? $this->option('isolated') - : $this->isolatedCommandExitCode); + : $this->isolatedExitCode); } $method = method_exists($this, 'handle') ? 'handle' : '__invoke';