Symfony\Component\Process\Process::getErrorOutput PHP Method

getErrorOutput() public method

Returns the current error output of the process (STDERR).
public getErrorOutput ( ) : string
return string The process error output
    public function getErrorOutput()
    {
        $this->readPipesForOutput(__FUNCTION__);
        if (false === ($ret = stream_get_contents($this->stderr, -1, 0))) {
            return '';
        }
        return $ret;
    }

Usage Example

 /**
  * @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());
     }
 }
All Usage Examples Of Symfony\Component\Process\Process::getErrorOutput