本文整理匯總了PHP中Process::getExitCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Process::getExitCode方法的具體用法?PHP Process::getExitCode怎麽用?PHP Process::getExitCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Process
的用法示例。
在下文中一共展示了Process::getExitCode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeCommand
/**
* Executes the given command via shell and returns the complete output as
* a string
*
* @param string $command
*
* @return array(status, stdout, stderr)
*/
protected function executeCommand($command)
{
if (class_exists('Symfony\\Component\\Process\\Process')) {
$process = new \Symfony\Component\Process\Process($command, $this->env);
if ($this->timeout !== false) {
$process->setTimeout($this->timeout);
}
} else {
$process = new Process($command, $this->env);
}
$process->run();
return array($process->getExitCode(), $process->getOutput(), $process->getErrorOutput());
}
示例2: executeCommand
/**
* Executes the given command via shell and returns the complete output as
* a string
*
* @param string $command
*
* @return array(status, stdout, stderr)
*/
protected function executeCommand($command)
{
$process = new Process($command, null, $this->env);
if (false !== $this->timeout) {
$process->setTimeout($this->timeout);
}
$process->run();
return array($process->getExitCode(), $process->getOutput(), $process->getErrorOutput());
}
示例3: print_update_step_output
/**
* Print update progress as dots for updating feature file step list.
*
* @param Process $process process executing update step command.
* @param string $featurestepfile feature step file in which steps will be saved.
* @return int exitcode.
*/
function print_update_step_output($process, $featurestepfile)
{
$printedlength = 0;
echo "Updating steps feature file for parallel behat runs" . PHP_EOL;
// Show progress while running command.
while ($process->isRunning()) {
usleep(10000);
$op = $process->getIncrementalOutput();
if (trim($op)) {
echo ".";
$printedlength++;
if ($printedlength > 70) {
$printedlength = 0;
echo PHP_EOL;
}
}
}
// If any error then exit.
$exitcode = $process->getExitCode();
// Output err.
if ($exitcode != 0) {
echo $process->getErrorOutput();
exit($exitcode);
}
// Extract features with step info and save it in file.
$featuresteps = $process->getOutput();
$featuresteps = explode(PHP_EOL, $featuresteps);
$realroot = realpath(__DIR__ . '/../../../../') . '/';
foreach ($featuresteps as $featurestep) {
if (trim($featurestep)) {
$step = explode("::", $featurestep);
$step[0] = str_replace($realroot, '', $step[0]);
$steps[$step[0]] = $step[1];
}
}
arsort($steps);
if (!@file_put_contents($featurestepfile, json_encode($steps, JSON_PRETTY_PRINT))) {
behat_error(BEHAT_EXITCODE_PERMISSIONS, 'File ' . $featurestepfile . ' can not be created');
$exitcode = -1;
}
echo PHP_EOL . "Updated step count in " . $featurestepfile . PHP_EOL;
return $exitcode;
}
示例4: executeCommand
/**
* Executes the given command via shell and returns the complete output as
* a string
*
* @param string $command
*
* @return array(status, stdout, stderr)
*/
protected function executeCommand($command)
{
if (class_exists('Symfony\\Component\\Process\\Process')) {
$process = new \Symfony\Component\Process\Process($command);
} else {
$process = new Process($command);
}
$process->run();
return array($process->getExitCode(), $process->getOutput(), $process->getErrorOutput());
}