diff --git a/src/Illuminate/Foundation/Console/Kernel.php b/src/Illuminate/Foundation/Console/Kernel.php index ec46c44dbd46..ce7d0425292d 100644 --- a/src/Illuminate/Foundation/Console/Kernel.php +++ b/src/Illuminate/Foundation/Console/Kernel.php @@ -43,6 +43,13 @@ class Kernel implements KernelContract */ protected $commands = []; + /** + * Indicates if the Closure commands have been loaded. + * + * @var bool + */ + protected $commandsLoaded = false; + /** * The bootstrap classes for the application. * @@ -77,8 +84,6 @@ public function __construct(Application $app, Dispatcher $events) $this->app->booted(function () { $this->defineConsoleSchedule(); - - $this->commands(); }); } @@ -108,6 +113,12 @@ public function handle($input, $output = null) try { $this->bootstrap(); + if (! $this->commandsLoaded) { + $this->commands(); + + $this->commandsLoaded = true; + } + return $this->getArtisan()->run($input, $output); } catch (Exception $e) { $this->reportException($e);