Skip to content

Commit

Permalink
fix: schedule:test on commands using runInBackground (#54321)
Browse files Browse the repository at this point in the history
Force to run the selected command in the foreground.

The `artisan schedule:test` command exited immediately after invocation
and the selected command did not start if it uses `->runInBackground()`.
If `->withoutOverlapping()` is used too, the mutex would not be removed
and blocks any further execution without any user facing notice.
  • Loading branch information
dallyger authored Jan 23, 2025
1 parent 066b740 commit e365c08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Illuminate/Console/Scheduling/ScheduleTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ public function handle(Schedule $schedule)
$description = sprintf(
'Running [%s]%s',
$command,
$event->runInBackground ? ' in background' : '',
$event->runInBackground ? ' normally in background' : '',
);

$event->runInBackground = false;

$this->components->task($description, fn () => $event->run($this->laravel));

if (! $event instanceof CallbackEvent) {
Expand Down

0 comments on commit e365c08

Please sign in to comment.