本文整理汇总了PHP中Symfony\Component\Process\Process::getStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::getStatus方法的具体用法?PHP Process::getStatus怎么用?PHP Process::getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Process\Process
的用法示例。
在下文中一共展示了Process::getStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute_behat_generator
/**
* Execute behat command for featurename and return exit status.
*
* @param string $featurename name of the feature
* @param string $featurepath path of feature file
* @return int status code.
*/
protected function execute_behat_generator($featurename, $featurepath)
{
$cmd = "vendor/bin/behat --config " . util::get_tool_dir() . DIRECTORY_SEPARATOR . 'behat.yml ' . $featurepath;
$process = new symfonyprocess($cmd);
$process->setWorkingDirectory(__DIR__ . "/../../moodle");
$process->setTimeout(null);
$process->start();
if ($process->getStatus() !== 'started') {
echo "Error starting process: {$featurename}";
$process->signal(SIGKILL);
exit(1);
}
while ($process->isRunning()) {
$output = $process->getIncrementalOutput();
// Don't show start data everytime.
$output = preg_replace('/[a-z0-9.\\(\\)].*/im', '', $output);
$op = trim($output);
if (!empty($op)) {
echo $output;
}
}
return $process->getExitCode();
}
示例2: execute_behat_generator
/**
* Execute behat command for featurename and return exit status.
*
* @return int status code.
*/
protected function execute_behat_generator()
{
$cmd = "vendor/bin/behat --config " . util::get_tool_dir() . DIRECTORY_SEPARATOR . 'behat.yml ';
$process = new Process($cmd);
$process->setWorkingDirectory(__DIR__ . "/../../../../../");
$process->setTimeout(null);
$process->start();
if ($process->getStatus() !== 'started') {
echo "Error starting process";
$process->signal(SIGKILL);
exit(1);
}
while ($process->isRunning()) {
$output = $process->getIncrementalOutput();
$op = trim($output);
if (!empty($op)) {
echo $output;
}
}
if ($process->getExitCode() !== 0) {
echo $process->getErrorOutput();
}
return $process->getExitCode();
}