/** * 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(); }
public function isRunning() { if ($pid = $this->getPid()) { $process = new Process(sprintf('ps -p "%s"', $pid)); $process->run(); return $process->isSuccessful(); } return false; }
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; }