diff --git a/src/Illuminate/Console/Command.php b/src/Illuminate/Console/Command.php index 4ae96d68d97a..4d27527b9245 100755 --- a/src/Illuminate/Console/Command.php +++ b/src/Illuminate/Console/Command.php @@ -61,6 +61,20 @@ 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 default exit code for isolated commands. + * + * @var int + */ + protected $isolatedExitCode = self::SUCCESS; + /** * The console command name aliases. * @@ -140,7 +154,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 )); } @@ -185,7 +199,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return (int) (is_numeric($this->option('isolated')) ? $this->option('isolated') - : self::SUCCESS); + : $this->isolatedExitCode); } $method = method_exists($this, 'handle') ? 'handle' : '__invoke';