Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1deaa36

Browse filesBrowse files
12.x scheduled task failed not dispatched on scheduled task failing (#55572)
* Enhance ScheduleRunCommand to dispatch failure events and add integration test - Updated `ScheduleRunCommand` to dispatch `ScheduledTaskFailed` event when a scheduled command fails. - Added handling for exit codes to improve error reporting. - Introduced `ScheduleRunCommandTest` to verify that failure events are dispatched correctly for failing scheduled tasks. * Enhance ScheduleRunCommand to dispatch failure events and add integration test - Updated `ScheduleRunCommand` to dispatch `ScheduledTaskFailed` event when a scheduled command fails. - Added handling for exit codes to improve error reporting. - Introduced `ScheduleRunCommandTest` to verify that failure events are dispatched correctly for failing scheduled tasks. * Enhance ScheduleRunCommand to dispatch failure events and add integration test - Updated `ScheduleRunCommand` to dispatch `ScheduledTaskFailed` event when a scheduled command fails. - Added handling for exit codes to improve error reporting. - Introduced `ScheduleRunCommandTest` to verify that failure events are dispatched correctly for failing scheduled tasks. * remove the test class as it's not consistent due to the event scheduling testing complication * remove the test class as it's not consistent due to the event scheduling testing complication * formatting --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent d74311d commit 1deaa36
Copy full SHA for 1deaa36

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed

‎src/Illuminate/Console/Scheduling/ScheduleRunCommand.php

Copy file name to clipboardExpand all lines: src/Illuminate/Console/Scheduling/ScheduleRunCommand.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Illuminate\Console\Scheduling;
44

5+
use Exception;
56
use Illuminate\Console\Application;
67
use Illuminate\Console\Command;
78
use Illuminate\Console\Events\ScheduledTaskFailed;
@@ -196,6 +197,10 @@ protected function runEvent($event)
196197
round(microtime(true) - $start, 2)
197198
));
198199

200+
if ($event->exitCode !== 0) {
201+
throw new Exception("Scheduled command [{$event->command}] failed with exit code [{$event->exitCode}].");
202+
}
203+
199204
$this->eventsRan = true;
200205
} catch (Throwable $e) {
201206
$this->dispatcher->dispatch(new ScheduledTaskFailed($event, $e));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.