本文整理汇总了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());
}
}
示例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());
}
示例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;
}
示例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());
}
}
示例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']);
}
}
示例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;
}
示例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));
}
}
示例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());
}
}
示例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;
}
示例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();
}
示例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);
}
示例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());
}
}
示例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());
}
}
示例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);
}
}
示例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();
}