Skip to content

Commit

Permalink
[5.4] Ability to pass output buffer to Artisan::call() (#16930)
Browse files Browse the repository at this point in the history
* Ability to pass outputBuffer to console commands called in code

*    update docblocks
  • Loading branch information
themsaid authored and taylorotwell committed Dec 23, 2016
1 parent e18473d commit 5e5be5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Illuminate/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ protected function bootstrap()
*
* @param string $command
* @param array $parameters
* @param \Symfony\Component\Console\Output\OutputInterface $outputBuffer
* @return int
*/
public function call($command, array $parameters = [])
public function call($command, array $parameters = [], $outputBuffer = null)
{
$parameters = collect($parameters)->prepend($command);

$this->lastOutput = new BufferedOutput;
$this->lastOutput = $outputBuffer ?: new BufferedOutput;

$this->setCatchExceptions(false);

Expand Down
5 changes: 3 additions & 2 deletions src/Illuminate/Foundation/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ public function registerCommand($command)
*
* @param string $command
* @param array $parameters
* @param \Symfony\Component\Console\Output\OutputInterface $outputBuffer
* @return int
*/
public function call($command, array $parameters = [])
public function call($command, array $parameters = [], $outputBuffer = null)
{
$this->bootstrap();

Expand All @@ -215,7 +216,7 @@ public function call($command, array $parameters = [])
$this->commandsLoaded = true;
}

return $this->getArtisan()->call($command, $parameters);
return $this->getArtisan()->call($command, $parameters, $outputBuffer);
}

/**
Expand Down

0 comments on commit 5e5be5c

Please sign in to comment.