本文整理匯總了PHP中Process::isSuccessful方法的典型用法代碼示例。如果您正苦於以下問題:PHP Process::isSuccessful方法的具體用法?PHP Process::isSuccessful怎麽用?PHP Process::isSuccessful使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Process
的用法示例。
在下文中一共展示了Process::isSuccessful方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wait
/**
* 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: isRunning
public function isRunning()
{
if ($pid = $this->getPid()) {
$process = new Process(sprintf('ps -p "%s"', $pid));
$process->run();
return $process->isSuccessful();
}
return false;
}
示例3: install
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;
}