Esempio n. 1
0
 /**
  * Execute a bash command.
  *
  * @param array $command
  * @param bool  $showOutput
  *
  * @return string
  */
 protected function execute(array $command, $showOutput = true)
 {
     $helper = new ProcessHelper();
     $helper->setHelperSet(new HelperSet(['debug_formatter' => new DebugFormatterHelper()]));
     // Compute new verbosity
     $previousVerbosity = $this->output->getVerbosity();
     $verbosity = $showOutput ? OutputInterface::VERBOSITY_DEBUG : OutputInterface::VERBOSITY_QUIET;
     // Execute command with defined verbosity
     $this->output->setVerbosity($verbosity);
     $process = $helper->run($this->output, $command);
     $this->output->setVerbosity($previousVerbosity);
     return $process->getOutput();
 }