當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。