Skip to content

Commit

Permalink
Merge pull request #3 from andriuspetrauskis/status-check-command-ret…
Browse files Browse the repository at this point in the history
…urn-exit-code

StatusCheckCommand: return the exit code accordingly to global status
  • Loading branch information
developer-ns authored May 7, 2021
2 parents 32b8fc7 + c3a1454 commit 43f2090
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Commands/StatusCheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Nordsec\StatusChecker\Commands;

use Nordsec\StatusChecker\Services\StatusCheckerInterface;
use Nordsec\StatusChecker\Services\StatusCheckerService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -34,5 +35,11 @@ public function execute(InputInterface $input, OutputInterface $output)
foreach ($details as $checkerName => $status) {
$output->writeln(sprintf('%s: %s', $checkerName, $status));
}

if ($this->statusCheckerService->checkGlobalStatus() !== StatusCheckerInterface::STATUS_OK) {
return static::FAILURE;
}

return static::SUCCESS;
}
}

0 comments on commit 43f2090

Please sign in to comment.