From 2b5e5e7b673df33d7e0fe658ffbd28511be05849 Mon Sep 17 00:00:00 2001 From: tarkis Date: Wed, 30 Apr 2025 10:48:51 +0300 Subject: [PATCH 1/2] Adds exitCode for schedule tasks running in background --- src/Illuminate/Console/Scheduling/Event.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index 944728361a7f..d3865128dd77 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -130,10 +130,10 @@ public function run(Container $container) return; } - $exitCode = $this->start($container); + $this->exitCode = $this->start($container); if (! $this->runInBackground) { - $this->finish($container, $exitCode); + $this->finish($container); } } @@ -210,13 +210,10 @@ protected function execute($container) * Mark the command process as finished and run callbacks/cleanup. * * @param \Illuminate\Contracts\Container\Container $container - * @param int $exitCode * @return void */ - public function finish(Container $container, $exitCode) + public function finish(Container $container) { - $this->exitCode = (int) $exitCode; - try { $this->callAfterCallbacks($container); } finally { From 5dc621ea2d23630e52afd7d4c80061b4187baef2 Mon Sep 17 00:00:00 2001 From: tarkis Date: Wed, 30 Apr 2025 15:09:28 +0300 Subject: [PATCH 2/2] Reintroduce exitCode to Scheduling Event finish() --- src/Illuminate/Console/Scheduling/Event.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index d3865128dd77..1d5e35b63801 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -133,7 +133,7 @@ public function run(Container $container) $this->exitCode = $this->start($container); if (! $this->runInBackground) { - $this->finish($container); + $this->finish($container, $this->exitCode); } } @@ -210,10 +210,13 @@ protected function execute($container) * Mark the command process as finished and run callbacks/cleanup. * * @param \Illuminate\Contracts\Container\Container $container + * @param int $exitCode * @return void */ - public function finish(Container $container) + public function finish(Container $container, $exitCode) { + $this->exitCode = (int) $exitCode; + try { $this->callAfterCallbacks($container); } finally {