Procházet zdrojové kódy

cron command now fails if any job has failed

Olivier Massot před 3 roky
rodič
revize
f83564f622
1 změnil soubory, kde provedl 4 přidání a 2 odebrání
  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
     }
 
     /**