/** * Builds a command. * * @param string $sub_command Sub command. * @param string|null $param_string Parameter string. * * @return Command */ public function getCommand($sub_command, $param_string = null) { $command_line = $this->buildCommand($sub_command, $param_string); $command = new Command($this->_processFactory->createProcess($command_line, 1200), $this->_io, $this->_cacheManager); if (isset($this->_nextCommandCacheDuration)) { $command->setCacheDuration($this->_nextCommandCacheDuration); $this->_nextCommandCacheDuration = null; } return $command; }
/** * Runs the command. * * @param callable|null $callback Callback. * * @return string * @throws RepositoryCommandException When command execution failed. */ private function _doRun($callback = null) { $process = $this->_processFactory->createProcess($this->_commandLine, 1200); try { $start = microtime(true); $process->mustRun($callback); if ($this->_io->isVerbose()) { $runtime = sprintf('%01.2f', microtime(true) - $start); $this->_io->writeln(array('', '<debug>[svn, ' . round($runtime, 2) . 's]: ' . $this->_commandLine . '</debug>')); } $output = (string) $process->getOutput(); if ($this->_io->isDebug()) { $this->_io->writeln($output, OutputInterface::OUTPUT_RAW); } return $output; } catch (ProcessFailedException $e) { throw new RepositoryCommandException($this->_commandLine, $process->getErrorOutput()); } }