/**
  * Blocks until call is complete.
  *
  * @throws \Exception        If this function is called before start()
  * @throws \RuntimeException
  *
  * @return string
  */
 public function wait()
 {
     if ($this->processAsync == null) {
         throw new \Exception('You must run `start` before running `wait`');
     }
     // blocks here until process completes
     $this->processAsync->wait();
     if (!$this->processAsync->isSuccessful()) {
         throw new \RuntimeException($this->processAsync->getErrorOutput());
     }
     return $this->processAsync->getOutput();
 }
示例#2
0
 public function isRunning()
 {
     if ($pid = $this->getPid()) {
         $process = new Process(sprintf('ps -p "%s"', $pid));
         $process->run();
         return $process->isSuccessful();
     }
     return false;
 }
示例#3
0
 protected function install()
 {
     $install = new Process(sprintf('cd %s && php composer.phar install', $this->projectDir));
     $install->run();
     if ($install->isSuccessful()) {
         $output->writeln('<info>Packages succesfully installed</info>');
         return true;
     }
     $this->failingProcess = $install;
     return false;
 }