Skip to content

Commit

Permalink
Merge branch 'metaworx-enh/return-exit-code'
Browse files Browse the repository at this point in the history
  • Loading branch information
theseer committed Sep 18, 2023
2 parents 2684aea + e516c4f commit 6194005
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public function __construct(Factory $factory) {
*
* @return int exit code
*/
public function run(array $env) {
public function run(array $env): int
{

try {

Expand All @@ -85,21 +86,21 @@ public function run(array $env) {
if ($input->getOption('help')->value === TRUE) {
$this->showVersion();
$this->showUsage();
exit(CLI::RC_OK);
return CLI::RC_OK;
}

if ($input->getOption('version')->value === TRUE ) {
$this->showVersion();
exit(CLI::RC_OK);
return CLI::RC_OK;
}

$config = $this->configure($env, $input);
$this->factory->setConfig($config);
if (!$config->isQuietMode()) {
$this->showVersion();
}
$rc = $this->factory->getApplication()->run();
return $rc;

return $this->factory->getApplication()->run();

} catch (CLIEnvironmentException $e) {
$this->showVersion();
Expand Down

0 comments on commit 6194005

Please sign in to comment.