diff --git a/src/Robo/Application.php b/src/Robo/Application.php new file mode 100644 index 000000000..9b3a8cc52 --- /dev/null +++ b/src/Robo/Application.php @@ -0,0 +1,28 @@ +doRunCommand($command, $input, $output); + } + +} diff --git a/src/Robo/Blt.php b/src/Robo/Blt.php index 9bdde3192..d1ef4742d 100644 --- a/src/Robo/Blt.php +++ b/src/Robo/Blt.php @@ -20,7 +20,6 @@ use Robo\Config\Config; use Robo\Robo; use Robo\Runner as RoboRunner; -use Symfony\Component\Console\Application; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -224,7 +223,8 @@ public function configureContainer($container) { * The exiting status code of the application */ public function run(InputInterface $input, OutputInterface $output) { - $status_code = $this->runner->run($input, $output, NULL, $this->commands); + $application = $this->getContainer()->get('application'); + $status_code = $this->runner->run($input, $output, $application, $this->commands); return $status_code; } diff --git a/src/Robo/BltTasks.php b/src/Robo/BltTasks.php index 00cf79db8..16491291a 100644 --- a/src/Robo/BltTasks.php +++ b/src/Robo/BltTasks.php @@ -93,16 +93,17 @@ protected function invokeCommand($command_name, array $args = []) { return 0; } - /** @var \Robo\Application $application */ + /** @var \Acquia\Blt\Robo\Application $application */ $application = $this->getContainer()->get('application'); $command = $application->find($command_name); + $input = new ArrayInput($args); $prefix = str_repeat(">", $this->invokeDepth); $this->output->writeln("$prefix $command_name"); - $returnCode = $command->run($input, $this->output()); + $return_code = $application->runCommand($command, $input, $this->output()); $this->invokeDepth--; - return $returnCode; + return $return_code; } /** diff --git a/src/Robo/Hooks/CommandEventHook.php b/src/Robo/Hooks/CommandEventHook.php index 1f4823668..a0e33fc78 100644 --- a/src/Robo/Hooks/CommandEventHook.php +++ b/src/Robo/Hooks/CommandEventHook.php @@ -36,6 +36,7 @@ public function executeInDrupalVm(ConsoleCommandEvent $event) { if (method_exists($command, 'getAnnotationData')) { /* @var \Consolidation\AnnotatedCommand\AnnotationData */ $annotation_data = $event->getCommand()->getAnnotationData(); + $this->warnIfDrupalVmNotRunning(); if ($annotation_data->has('executeInDrupalVm') && $this->shouldExecuteInDrupalVm()) { $event->disableCommand(); $args = $this->getCliArgs(); @@ -95,4 +96,13 @@ protected function shouldExecuteInDrupalVm() { && !$this->getInspector()->isVmCli(); } + /** + * Emits a warning if Drupal VM is initialized but not running. + */ + protected function warnIfDrupalVmNotRunning() { + if ($this->getInspector()->isDrupalVmLocallyInitialized() && !$this->getInspector()->isDrupalVmBooted()) { + $this->logger->warning("Drupal VM is locally initialized, but it not running."); + } + } + }