Skip to content

Commit dee49ac

Browse files
authored
Merge pull request #218 from mlocati/install-return-code
Exit with non-zero when pecl install fails
2 parents 6ee26d7 + a651036 commit dee49ac

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Console/Command/InstallerCommand.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected function binaryInstallWindows($path, InputInterface $input, OutputInte
167167
}
168168

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

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

183183
$this->saveBuildLogs($input, $build);
184+
$result = true;
184185
} catch (Exception $e) {
185186
$this->saveBuildLogs($input, $build);
186187

@@ -189,8 +190,11 @@ protected function sourceInstall($package, InputInterface $input, OutputInterfac
189190
if ($helper->ask($input, $output, $prompt)) {
190191
$output->write($build->getLog());
191192
}
193+
$result = false;
192194
}
193195
$build->cleanup();
196+
197+
return $result;
194198
}
195199

196200
protected function execute(InputInterface $input, OutputInterface $output)
@@ -217,9 +221,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
217221
return 0;
218222
}
219223

220-
$this->sourceInstall($package, $input, $output, $optionsValue, $force_opts);
221-
222-
return 0;
224+
return $this->sourceInstall($package, $input, $output, $optionsValue, $force_opts) ? 0 : 1;
223225
}
224226
}
225227

0 commit comments

Comments
 (0)