Quellcode durchsuchen

cron command now fails if any job has failed

Olivier Massot vor 3 Jahren
Ursprung
Commit
f83564f622
1 geänderte Dateien mit 4 neuen und 2 gelöschten Zeilen
  1. 4 2
      src/Commands/CronCommand.php

+ 4 - 2
src/Commands/CronCommand.php

@@ -131,11 +131,13 @@ class CronCommand extends Command
             implode(', ', array_map(static function($job) { return $job->name(); }, $jobs))
         );
 
+        $results = [];
+
         foreach ($jobs as $job) {
-            $this->runJob($job, $preview);
+            $results[] = $this->runJob($job, $preview);
         }
 
-        return Command::SUCCESS;
+        return max($results); // If there is one failure result, the whole command is shown as a failure too
     }
 
     /**