ソースを参照

cron command now fails if any job has failed

Olivier Massot 3 年 前
コミット
f83564f622
1 ファイル変更4 行追加2 行削除
  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
     }
 
     /**