当前位置: 首页>>代码示例>>PHP>>正文


PHP Process::getOutput方法代码示例

本文整理汇总了PHP中Process::getOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::getOutput方法的具体用法?PHP Process::getOutput怎么用?PHP Process::getOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Process的用法示例。


在下文中一共展示了Process::getOutput方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: detectProcessorNumberByGrep

 protected function detectProcessorNumberByGrep()
 {
     if (Utils::findBin('grep') && file_exists('/proc/cpuinfo')) {
         $process = new Process('grep -c ^processor /proc/cpuinfo 2>/dev/null');
         $process->run();
         $this->processorNumber = intval($process->getOutput());
         return $this->processorNumber;
     }
     return;
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:10,代码来源:Machine.php

示例2: 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();
 }
开发者ID:petrofcz,项目名称:php-mediainfo,代码行数:20,代码来源:MediaInfoCommandRunner.php

示例3: 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());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:21,代码来源:AbstractGenerator.php

示例4: 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;
}
开发者ID:sriysk,项目名称:moodle-integration,代码行数:50,代码来源:util_single_run.php

示例5: 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());
 }
开发者ID:cogitech-group,项目名称:sfWkHtmlToPdfPlugin,代码行数:17,代码来源:AbstractGenerator.php

示例6: 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());
 }
开发者ID:jxav,项目名称:paintstrap,代码行数:18,代码来源:AbstractGenerator.php


注:本文中的Process::getOutput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。