Skip to content

Commit

Permalink
fix closure based console commands
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 24, 2016
1 parent 7d116dc commit 26eaa35
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Illuminate/Foundation/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -77,8 +84,6 @@ public function __construct(Application $app, Dispatcher $events)

$this->app->booted(function () {
$this->defineConsoleSchedule();

$this->commands();
});
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 26eaa35

Please sign in to comment.