Skip to content

Commit

Permalink
Merge pull request #218 from mlocati/install-return-code
Browse files Browse the repository at this point in the history
Exit with non-zero when pecl install fails
  • Loading branch information
mlocati authored Jan 25, 2021
2 parents 6ee26d7 + a651036 commit dee49ac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Console/Command/InstallerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected function binaryInstallWindows($path, InputInterface $input, OutputInte
}

/* The most of this needs to be incapsulated into an extra Build class*/
protected function sourceInstall($package, InputInterface $input, OutputInterface $output, $optionsValue = [], $force_opts = '')
protected function sourceInstall($package, InputInterface $input, OutputInterface $output, $optionsValue = [], $force_opts = ''): bool
{
$helper = $this->getHelperSet()->get('question');

Expand All @@ -181,6 +181,7 @@ protected function sourceInstall($package, InputInterface $input, OutputInterfac
$build->install();

$this->saveBuildLogs($input, $build);
$result = true;
} catch (Exception $e) {
$this->saveBuildLogs($input, $build);

Expand All @@ -189,8 +190,11 @@ protected function sourceInstall($package, InputInterface $input, OutputInterfac
if ($helper->ask($input, $output, $prompt)) {
$output->write($build->getLog());
}
$result = false;
}
$build->cleanup();

return $result;
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand All @@ -217,9 +221,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 0;
}

$this->sourceInstall($package, $input, $output, $optionsValue, $force_opts);

return 0;
return $this->sourceInstall($package, $input, $output, $optionsValue, $force_opts) ? 0 : 1;
}
}

Expand Down

0 comments on commit dee49ac

Please sign in to comment.