diff --git a/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php b/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php
index 5a7e4be800..92a276bfba 100644
--- a/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php
+++ b/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php
@@ -13,8 +13,8 @@
use Symfony\Component\Console\Output\OutputInterface;
use Sensio\Bundle\GeneratorBundle\Command\Validators;
use Symfony\Component\HttpKernel\Kernel;
-use Symfony\Component\Process\Exception\RuntimeException;
use Sensio\Bundle\GeneratorBundle\Command\Helper\QuestionHelper;
+use Symfony\Component\Process\Process;
/**
* Kunstmaan installer
@@ -152,7 +152,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
->executeCommand($output, 'doctrine:database:create')
->executeCommand($output, 'doctrine:schema:drop', ['--force' => true])
->executeCommand($output, 'doctrine:schema:create')
- ->executeCommand($output, 'doctrine:fixtures:load')
+ ->executeCommand($output, 'doctrine:fixtures:load', ['-n' => true], true)
->executeCommand($output, 'assets:install')
;
@@ -169,26 +169,29 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->assistant->writeSection('PRO TIP: If you like to use the default frontend setup, run the buildUI.sh script or run the commands separate to compile the frontend assets. ', 'bg=blue;fg=white');
}
- protected function executeCommand(OutputInterface $output, $command, array $options = [])
+ protected function executeCommand(OutputInterface $output, $command, array $options = [], $separateProcess = false)
{
- $options = array_merge(
- [
- '--no-debug' => true,
- ],
- $options
- );
+ $options = array_merge(['--no-debug' => true], $options);
++$this->commandSteps;
try {
- $updateInput = new ArrayInput($options);
- $updateInput->setInteractive(true);
- $this->getApplication()->find($command)->run($updateInput, $output);
+ if ($separateProcess) {
+ $process = new Process(array_merge(['bin/console', $command], array_keys($options)));
+ $process->setTty(true);
+ $process->run();
+
+ if (!$process->isSuccessful()) {
+ throw new \RuntimeException($process->getErrorOutput());
+ }
+ } else {
+ $updateInput = new ArrayInput($options);
+ $updateInput->setInteractive(true);
+ $this->getApplication()->find($command)->run($updateInput, $output);
+ }
$output->writeln(sprintf('Step %d: "%s" - [OK]', $this->commandSteps, $command));
- } catch (RuntimeException $exception) {
- $output->writeln(sprintf('Step %d: "%s" - [FAILED]', $this->commandSteps, $command));
} catch (\Throwable $e) {
- $output->writeln(sprintf('Step %d: "%s" - [FAILED]', $this->commandSteps, $command));
+ $output->writeln(sprintf('Step %d: "%s" - [FAILED] Message: %s', $this->commandSteps, $command, $e->getMessage()));
}
return $this;