Skip to content

Commit

Permalink
Merge pull request #41 from scolandrea/fix-return-code-commands
Browse files Browse the repository at this point in the history
Adding return code for commands
  • Loading branch information
VladyslavSikailo authored Nov 22, 2023
2 parents 7e30176 + 754585d commit 013b002
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Console/Command/CollectMetricsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Magento\Framework\App\Area;
use Magento\Framework\App\State;
use Magento\Framework\Console\Cli;
use Magento\Framework\Exception\LocalizedException;
use RunAsRoot\PrometheusExporter\Cron\AggregateMetricsCron;
use Symfony\Component\Console\Command\Command;
Expand Down Expand Up @@ -60,5 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$this->aggregateMetricsCron->execute();
}

return Cli::RETURN_SUCCESS;
}
}
5 changes: 4 additions & 1 deletion src/Console/Command/ListMetricsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\App\Area;
use Magento\Framework\App\State;
use Magento\Framework\Console\Cli;
use Magento\Framework\Exception\LocalizedException;
use RunAsRoot\PrometheusExporter\Api\Data\MetricInterface;
use RunAsRoot\PrometheusExporter\Api\MetricRepositoryInterface;
Expand Down Expand Up @@ -58,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($searchResults->getTotalCount() === 0) {
$output->writeln('No metrics found');

return;
return Cli::RETURN_SUCCESS;
}

/** @var MetricInterface[] $metrics */
Expand All @@ -72,5 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

$table->render();

return Cli::RETURN_SUCCESS;
}
}

0 comments on commit 013b002

Please sign in to comment.