Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/Illuminate/Queue/Console/WorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function handle()
// connection being run for the queue operation currently being executed.
$queue = $this->getQueue($connection);

if (! $this->hasOption('json') && Terminal::hasSttyAvailable()) {
if (! $this->outputUsingJson() && Terminal::hasSttyAvailable()) {
$this->components->info(
sprintf('Processing jobs from the [%s] %s.', $queue, str('queue')->plural(explode(',', $queue)))
);
Expand Down Expand Up @@ -201,7 +201,7 @@ protected function listenForEvents()
*/
protected function writeOutput(Job $job, $status, Throwable $exception = null)
{
$this->hasOption('json')
$this->outputUsingJson()
? $this->writeOutputAsJson($job, $status, $exception)
: $this->writeOutputForCli($job, $status);
}
Expand Down Expand Up @@ -346,4 +346,18 @@ protected function downForMaintenance()
{
return $this->option('force') ? false : $this->laravel->isDownForMaintenance();
}

/**
* Determine if the worker should output using JSON.
*
* @return bool
*/
protected function outputUsingJson()
{
if (! $this->hasOption('json')) {
return false;
}

return $this->option('json');
}
}
Loading