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


PHP Process::getErrorOutput方法代码示例

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


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

示例1: check

 /**
  * {@inheritdoc}
  */
 public function check()
 {
     if (!$this->isSuccessful()) {
         // on some systems stderr is used, but on others, it's not
         throw new LintingException($this->process->getErrorOutput() ?: $this->process->getOutput(), $this->process->getExitCode());
     }
 }
开发者ID:fabpot,项目名称:php-cs-fixer,代码行数:10,代码来源:ProcessLintingResult.php

示例2: testControlledExit

 public function testControlledExit()
 {
     if (!extension_loaded('pcntl')) {
         $this->markTestSkipped('PCNTL extension is not loaded.');
     }
     $proc = new Process('exec ' . PHP_BINARY . ' ' . escapeshellarg(__DIR__ . '/console') . ' jms-job-queue:run --worker-name=test --verbose --max-runtime=999999');
     $proc->start();
     usleep(500000.0);
     $this->assertTrue($proc->isRunning(), 'Process exited prematurely: ' . $proc->getOutput() . $proc->getErrorOutput());
     $this->assertTrueWithin(3, function () use($proc) {
         return false !== strpos($proc->getOutput(), 'Signal Handlers have been installed');
     }, function () use($proc) {
         $this->fail('Signal handlers were not installed: ' . $proc->getOutput() . $proc->getErrorOutput());
     });
     $proc->signal(SIGTERM);
     $this->assertTrueWithin(3, function () use($proc) {
         return false !== strpos($proc->getOutput(), 'Received SIGTERM');
     }, function () use($proc) {
         $this->fail('Signal was not received by process within 3 seconds: ' . $proc->getOutput() . $proc->getErrorOutput());
     });
     $this->assertTrueWithin(3, function () use($proc) {
         return !$proc->isRunning();
     }, function () use($proc) {
         $this->fail('Process did not terminate within 3 seconds: ' . $proc->getOutput() . $proc->getErrorOutput());
     });
     $this->assertContains('All jobs finished, exiting.', $proc->getOutput());
 }
开发者ID:ezprit,项目名称:JMSJobQueueBundle,代码行数:27,代码来源:SignalTest.php

示例3: compile

 /**
  * @return string
  */
 public function compile()
 {
     $this->stopwatch->start('webpack.total');
     $this->stopwatch->start('webpack.prepare');
     // Recompile twig templates where its needed.
     $this->addSplitPoints();
     $this->addResolveConfig();
     // Write the webpack configuration file.
     file_put_contents($this->cache_dir . DIRECTORY_SEPARATOR . 'webpack.config.js', $this->generator->getConfiguration());
     $this->profiler->set('compiler.performance.prepare', $this->stopwatch->stop('webpack.prepare')->getDuration());
     $this->stopwatch->start('webpack.compiler');
     $this->process->run();
     $output = $this->process->getOutput() . $this->process->getErrorOutput();
     $this->profiler->set('compiler.executed', true);
     $this->profiler->set('compiler.successful', strpos($output, 'Error:') === false);
     $this->profiler->set('compiler.last_output', $output);
     if ($this->profiler->get('compiler.successful')) {
         $this->tracker->rebuild();
     }
     // Finally, write some logging for later use.
     file_put_contents($this->cache_dir . DIRECTORY_SEPARATOR . 'webpack.compiler.log', $output);
     $this->profiler->set('compiler.performance.compiler', $this->stopwatch->stop('webpack.compiler')->getDuration());
     $this->profiler->set('compiler.performance.total', $this->stopwatch->stop('webpack.total')->getDuration());
     return $output;
 }
开发者ID:studionone,项目名称:webpack-bundle,代码行数:28,代码来源:Compiler.php

示例4: perform

 /**
  * @param GitLocaleCloneAction $action
  */
 public function perform(GitLocaleCloneAction $action)
 {
     $content = $action->getData()['content'];
     if (true === $action->getData()['debug']) {
         $url = sprintf('https://github.com/%s/test-hook.git', $this->login);
         $content['pull_request']['head']['repo']['clone_url'] = $url;
     }
     $cmd = [];
     $cmd[] = 'cd analyze';
     $cmd[] = 'mkdir -p ' . $content['pull_request']['head']['sha'];
     $cmd[] = 'cd ' . $content['pull_request']['head']['sha'];
     $cmd[] = sprintf('git clone -b %s %s', $content['pull_request']['head']['ref'], $content['pull_request']['head']['repo']['clone_url']);
     if (null !== $this->logger) {
         $this->logger->debug(sprintf('Start command %s', implode(' && ', $cmd)));
     }
     $process = new Process(implode(' && ', $cmd));
     $process->setTimeout(360);
     $process->run();
     if (!$process->isSuccessful()) {
         if (null !== $this->logger) {
             $this->logger->error($process->getErrorOutput());
         }
         throw new \RuntimeException($process->getErrorOutput());
     }
 }
开发者ID:puterakahfi,项目名称:certificationy-web-platform,代码行数:28,代码来源:GitLocaleCloneReaction.php

示例5: testIntegration

 /**
  * @dataProvider getTestFiles
  */
 public function testIntegration(\SplFileInfo $testFile)
 {
     $testData = $this->parseTestFile($testFile);
     $cmd = 'php ' . __DIR__ . '/../../../bin/composer --no-ansi ' . $testData['RUN'];
     $proc = new Process($cmd);
     $exitcode = $proc->run();
     if (isset($testData['EXPECT'])) {
         $this->assertEquals($testData['EXPECT'], $this->cleanOutput($proc->getOutput()), 'Error Output: ' . $proc->getErrorOutput());
     }
     if (isset($testData['EXPECT-REGEX'])) {
         $this->assertRegExp($testData['EXPECT-REGEX'], $this->cleanOutput($proc->getOutput()), 'Error Output: ' . $proc->getErrorOutput());
     }
     if (isset($testData['EXPECT-ERROR'])) {
         $this->assertEquals($testData['EXPECT-ERROR'], $this->cleanOutput($proc->getErrorOutput()));
     }
     if (isset($testData['EXPECT-ERROR-REGEX'])) {
         $this->assertRegExp($testData['EXPECT-ERROR-REGEX'], $this->cleanOutput($proc->getErrorOutput()));
     }
     if (isset($testData['EXPECT-EXIT-CODE'])) {
         $this->assertSame($testData['EXPECT-EXIT-CODE'], $exitcode);
     }
     // Clean up.
     $fs = new Filesystem();
     if (isset($testData['test_dir']) && is_dir($testData['test_dir'])) {
         $fs->removeDirectory($testData['test_dir']);
     }
 }
开发者ID:rufinus,项目名称:composer,代码行数:30,代码来源:AllFunctionalTest.php

示例6: render

 function render($context = null, $vars = array())
 {
     $finder = new ExecutableFinder();
     $bin = @$this->options["tsc_bin"] ?: self::DEFAULT_TSC;
     $cmd = $finder->find($bin);
     if ($cmd === null) {
         throw new \UnexpectedValueException("'{$bin}' executable was not found. Make sure it's installed.");
     }
     $inputFile = sys_get_temp_dir() . '/pipe_typescript_input_' . uniqid() . '.ts';
     file_put_contents($inputFile, $this->getData());
     $outputFile = tempnam(sys_get_temp_dir(), 'pipe_typescript_output_') . '.js';
     $cmd .= " --out " . escapeshellarg($outputFile) . ' ' . escapeshellarg($inputFile);
     $process = new Process($cmd);
     $process->setEnv(array('PATH' => @$_SERVER['PATH'] ?: join(PATH_SEPARATOR, array("/bin", "/sbin", "/usr/bin", "/usr/local/bin", "/usr/local/share/npm/bin"))));
     if ($this->isFile()) {
         $process->setWorkingDirectory(dirname($this->source));
     }
     $process->run();
     unlink($inputFile);
     if ($process->getErrorOutput()) {
         throw new \RuntimeException("tsc({$this->source}) returned an error:\n {$process->getErrorOutput()}");
     }
     $data = file_get_contents($outputFile);
     unlink($outputFile);
     return $data;
 }
开发者ID:chh,项目名称:meta-template,代码行数:26,代码来源:TypeScriptTemplate.php

示例7: validateRun

 /**
  * Validate that a run process was successful.
  *
  * @throws \RuntimeException
  * @return void
  */
 protected function validateRun()
 {
     $status = $this->process->getExitCode();
     $error = $this->process->getErrorOutput();
     if ($status !== 0 and $error !== '') {
         throw new \RuntimeException(sprintf("The exit status code %s says something went wrong:\n stderr: %s\n stdout: %s\ncommand: %s.", $status, $error, $this->process->getOutput(), $this->command));
     }
 }
开发者ID:vuthaihoc,项目名称:pdf-parser,代码行数:14,代码来源:Process.php

示例8: archive

 /**
  * Executes the backup command.
  */
 public function archive()
 {
     $this->process->setCommandLine($this->getCommand());
     $this->process->run();
     if ($this->process->getErrorOutput()) {
         throw new \RuntimeException($this->process->getErrorOutput());
     }
 }
开发者ID:nadimtuhin,项目名称:archiver,代码行数:11,代码来源:ZipArchiver.php

示例9: runShellCommand

 /**
  * Executes a shell command.
  *
  * @param string $command
  *
  * @return $this
  */
 public function runShellCommand($command)
 {
     $this->process = new Process($command);
     $this->exitCode = $this->process->run();
     $this->stdOutput = $this->process->getOutput();
     $this->stdError = $this->process->getErrorOutput();
     return $this;
 }
开发者ID:cheppers,项目名称:robo-phpcs,代码行数:15,代码来源:Cli.php

示例10: process

 public function process()
 {
     $gammuPath = $this->container->getParameter('symfonian_id.gammu.gammu_path');
     $process = new Process(sprintf('%s -c %s --%s', $gammuPath, $this->config, $this->command));
     $process->run();
     if (!$process->isSuccessful() && $process->getErrorOutput()) {
         throw new \RuntimeException($process->getErrorOutput());
     }
     return $process->getOutput();
 }
开发者ID:TiiToo,项目名称:GammuBundle,代码行数:10,代码来源:GammuCommandProcessor.php

示例11: run

 public function run($sourcePath, Report $report)
 {
     $commandLine = $this->getParameter('command_line');
     $process = new Process($commandLine, $sourcePath);
     $process->run();
     $output = $process->getOutput();
     if ($errorOutput = $process->getErrorOutput()) {
         $output .= 'Error output' . PHP_EOL . PHP_EOL . $process->getErrorOutput();
     }
     $report->addActionData($this, $process->isSuccessful(), $output);
 }
开发者ID:jmfontaine,项目名称:soko,代码行数:11,代码来源:Command.php

示例12: process

 /**
  * @param $command
  * @throws ShellProcessFailed
  * @throws \Symfony\Component\Process\Exception\LogicException
  */
 public function process($command)
 {
     if (empty($command)) {
         return;
     }
     $this->process->setCommandLine($command);
     $this->process->run();
     if (!$this->process->isSuccessful()) {
         throw new ShellProcessFailed($this->process->getErrorOutput());
     }
 }
开发者ID:parabol,项目名称:laravel-cms,代码行数:16,代码来源:ShellProcessor.php

示例13: waitForServerToSTart

 private function waitForServerToSTart()
 {
     $timeout = microtime(true) + 5;
     while (!$this->isStarted()) {
         if (microtime(true) < $timeout) {
             sleep(0.1);
             continue;
         }
         throw new \RuntimeException('Webserver did not start within 5 seconds: ' . $this->process->getErrorOutput());
     }
 }
开发者ID:ciaranmcnulty,项目名称:behat-localwebserverextension,代码行数:11,代码来源:BuiltInWebserverController.php

示例14: executeProcess

 /**
  * Executes a Process and throws a consistent exception
  *
  * @param Process $process
  * @param bool $throwExceptionOnFailure
  * @param null $extraMessage
  * @throws GitException
  */
 private function executeProcess(Process $process, $throwExceptionOnFailure = true, $extraMessage = null)
 {
     $process->run();
     if (!$process->isSuccessful() && $throwExceptionOnFailure) {
         // sometimes an unsuccessful command will still render output, instead of error output
         // this happens, for example, when merging and having a conflict
         $output = $process->getErrorOutput() ? $process->getErrorOutput() : $process->getOutput();
         $msg = sprintf('Error executing "%s": %s', $process->getCommandLine(), $output);
         if ($extraMessage) {
             $msg = $extraMessage . ' ' . $msg;
         }
         throw new GitException($msg);
     }
 }
开发者ID:knpuniversity,项目名称:GittyUp,代码行数:22,代码来源:RemoteRepository.php

示例15: run

 /**
  * @param  string $bin
  * @param  array  $args
  * @return string
  */
 public function run($bin, $args)
 {
     if (!is_file($bin)) {
         throw new \InvalidArgumentException(sprintf('Binary %s not found', $bin));
     }
     $process = new Process(sprintf('"%s" %s', $bin, escapeshellcmd($this->arrayToArgsString($args))));
     $process->run();
     if (!$process->isSuccessful()) {
         $this->logger->critical($process->getErrorOutput());
         throw new \RuntimeException($process->getErrorOutput());
     }
     $this->logger->debug(sprintf('SIPS Request output: %s', $process->getOutput()));
     return $process->getOutput();
 }
开发者ID:lelivrescolaire,项目名称:KptivePaymentSipsBundle,代码行数:19,代码来源:Client.php


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