Detect error in exec call and output accordingly. Also fix trailing slash in path. Fix #746

This commit is contained in:
Flavio Copes 2016-04-12 16:02:36 +02:00
parent a58766be66
commit 88320607fa

View File

@ -109,10 +109,18 @@ class InstallCommand extends ConsoleCommand
$this->output->writeln('');
foreach ($this->config['git'] as $repo => $data) {
$this->destination = rtrim($this->destination, DS);
$path = $this->destination . DS . $data['path'];
if (!file_exists($path)) {
exec('cd "' . $this->destination . '" && git clone -b ' . $data['branch'] . ' ' . $data['url'] . ' ' . $data['path']);
$this->output->writeln('<green>SUCCESS</green> cloned <magenta>' . $data['url'] . '</magenta> -> <cyan>' . $path . '</cyan>');
exec('cd "' . $this->destination . '" && git clone -b ' . $data['branch'] . ' ' . $data['url'] . ' ' . $data['path'], $output, $return);
if (!$return) {
$this->output->writeln('<green>SUCCESS</green> cloned <magenta>' . $data['url'] . '</magenta> -> <cyan>' . $path . '</cyan>');
} else {
$this->output->writeln('<red>ERROR</red> cloning <magenta>' . $data['url']);
}
$this->output->writeln('');
} else {
$this->output->writeln('<red>' . $path . ' already exists, skipping...</red>');