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


PHP Process::getIncrementalErrorOutput方法代码示例

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


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

示例1: processOutput

 /**
  * Looks into and processes the child's output
  *
  * @param string $childName
  * @return void
  */
 public function processOutput($childName)
 {
     $output = $this->outputBuffer . $this->process->getIncrementalOutput();
     $errorOutput = $this->errorOutputBuffer . $this->process->getIncrementalErrorOutput();
     $outputLines = explode("\n", $output);
     $errorOutputLines = explode("\n", $errorOutput);
     if (count($outputLines) > 0) {
         $lastItem = array_pop($outputLines);
         $this->outputBuffer = $lastItem;
         $this->bufferLength += implode("\n", $outputLines);
         foreach ($outputLines as $line) {
             if (strstr($line, "[[CHILD::BUSY]]")) {
                 $this->parent->verboseOutput('<info>' . $childName . ' BUSY</info>');
                 $this->status = ChildProcessContainer::STATUS_BUSY;
             } elseif (strstr($line, "[[CHILD::READY]]")) {
                 $this->parent->verboseOutput('<info>' . $childName . ' READY</info>');
                 if ($this->status != ChildProcessContainer::STATUS_BUSY_BUT_SLEEPY) {
                     $this->status = ChildProcessContainer::STATUS_READY;
                 } else {
                     $this->status = ChildProcessContainer::STATUS_SLEEPY;
                 }
             } elseif (strlen($line) > 0) {
                 $this->parent->verboseOutput('<info>OUTPUT ' . $childName . ':</info>' . $line);
             }
         }
     }
     if (count($errorOutputLines) > 0) {
         $lastItemError = array_pop($errorOutputLines);
         $this->errorOutputBuffer = $lastItemError;
         $knownErrorOutput = implode("\n", $errorOutputLines);
         $this->bufferLength += strlen($knownErrorOutput);
     }
 }
开发者ID:webdevvie,项目名称:pheanstalk-task-queue-bundle,代码行数:39,代码来源:ChildProcessContainer.php

示例2: execute

 /**
  * Executes post install SH script
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param OutputInterface                                 $output
  *
  * @internal param \Symfony\Component\Console\Input\InputInterface $intput
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $command = $input->getOption("post");
     $output->writeln("");
     $output->writeln("========================");
     $output->writeln('Executing post ' . $command . ' script.');
     $output->writeln("========================");
     // TODO: openssl req -new -x509 -sha256 -days 365 -nodes -out /tmp/server.crt -keyout /tmp/server.key
     $process = new Process("/bin/bash ./src/FIT/NetopeerBundle/bin/netconfwebgui-postinstall.sh");
     $process->run();
     while ($process->isRunning()) {
         $process->getIncrementalOutput();
         $process->getIncrementalErrorOutput();
     }
     if (!$process->isSuccessful()) {
         $output->writeln("Error in post " . $command . " script occured.");
         $output->writeln($process->getErrorOutput());
     } else {
         $output->writeln($process->getOutput());
     }
     $output->writeln("========================");
     $output->writeln("End of post " . $command . " script");
     $output->writeln("========================");
 }
开发者ID:Barathi07,项目名称:Netopeer-GUI,代码行数:33,代码来源:ProjectInitCommand.php

示例3: testGetIncrementalErrorOutput

 public function testGetIncrementalErrorOutput()
 {
     $p = new Process(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { usleep(50000); file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));
     $p->start();
     while ($p->isRunning()) {
         $this->assertLessThanOrEqual(1, preg_match_all('/ERROR/', $p->getIncrementalErrorOutput(), $matches));
         usleep(20000);
     }
 }
开发者ID:billwaddyjr,项目名称:Favorite-This-Demo,代码行数:9,代码来源:AbstractProcessTest.php

示例4: startServer

 /**
  * @param $address
  * @param $environment
  */
 protected function startServer()
 {
     $publicDir = $this->getApplication()->getWorkingPath() . DS . 'public';
     $shellCommand = $this->getBaseCommand();
     $process = new Process($shellCommand, $publicDir);
     if ($this->getInput()->getOption('background')) {
         $process->disableOutput();
         $process->start();
         $processId = $this->getProcessId();
         $this->getApplication()->getConfig()->setOption('server', ['pid' => $processId, 'address' => $address = 'http://' . $this->getAddress()]);
         $this->getOutput()->writeln($this->info('Server has been started at ' . $address));
     } else {
         while ($process instanceof Process) {
             if (!$process->isStarted()) {
                 $process->start();
                 continue;
             }
             echo $process->getIncrementalOutput();
             echo $process->getIncrementalErrorOutput();
             if (!$process->isRunning() || $process->isTerminated()) {
                 $process = false;
                 $this->getOutput()->writeln("");
                 $this->getOutput()->writeln($this->info('Server has been stopped.'));
             }
             sleep(1);
         }
     }
 }
开发者ID:bluzphp,项目名称:bluzman,代码行数:32,代码来源:StartCommand.php

示例5: updateRelease

 /**
  * @param Process $process
  * @return callable
  */
 public function updateRelease(Process $process)
 {
     $out = $process->getIncrementalOutput() . $process->getIncrementalErrorOutput();
     $this->release->update(['raw_log' => $process->getOutput() . PHP_EOL . $process->getErrorOutput()]);
     if (!empty($out)) {
         $this->release->logger()->info($out);
     }
 }
开发者ID:dzirg44,项目名称:dogpro,代码行数:12,代码来源:PlaybookJob.php

示例6: getProcessOutput

 /**
  * Decorate and return Process output
  * @param Process $process
  * @return string
  */
 protected function getProcessOutput(Process $process)
 {
     $output = '';
     // Add standard process output
     if ($processOutput = $process->getIncrementalOutput()) {
         $processOutputLines = explode("\n", $processOutput);
         // color output lines containing "[WARN]"
         foreach ($processOutputLines as &$processOutputLine) {
             if (strpos($processOutputLine, '[WARN]') !== false) {
                 $processOutputLine = '<fg=black;bg=yellow>' . $processOutputLine . '</fg=black;bg=yellow>';
             } elseif (strpos($processOutputLine, '[DEBUG]') !== false) {
                 $processOutputLine = '<comment>' . $processOutputLine . '</comment>';
             }
         }
         $output .= implode("\n", $processOutputLines);
     }
     // Add error output
     if ($errorOutput = $process->getIncrementalErrorOutput()) {
         $output .= '<error>' . rtrim($errorOutput, PHP_EOL) . '</error>' . "\n";
     }
     return $output;
 }
开发者ID:jirinovak,项目名称:steward,代码行数:27,代码来源:RunTestsCommand.php


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