Esempio n. 1
0
 /**
  * @param $command
  *
  * @throws ProcessFailedException
  *
  * @return Process
  */
 public function exec($command)
 {
     $rootPath = $this->site->getRoot();
     $this->process = new Process($command);
     $this->process->setWorkingDirectory($rootPath);
     $this->process->enableOutput();
     $this->process->setTimeout(null);
     if ($this->shellexec_output) {
         $this->process->run(function ($type, $buffer) {
             $this->output->writeln(sprintf("<info>%s</info>", $buffer));
         });
     } else {
         $this->progress->start();
         $this->process->start();
         while ($this->process->isRunning()) {
             $this->advance();
         }
         $this->progress->finish();
     }
     if (!$this->process->isSuccessful()) {
         throw new ProcessFailedException($this->process);
     }
     return $this->process->isSuccessful();
 }