public function run($command, $args = array())
    {
        $process = $this->getProcess($command, $args);

        if ($this->logger) {
            $this->logger->info(sprintf('run command: %s "%s" ', $command, implode(' ', $args)));
            $before = microtime(true);
        }

        $process->run();

        $output = $process->getOutput();

        if ($this->logger && $this->debug) {
            $duration = microtime(true) - $before;
            $this->logger->debug(sprintf('last command (%s) duration: %sms', $command, sprintf('%.2f', $duration * 1000)));
            $this->logger->debug(sprintf('last command (%s) return code: %s', $command, $process->getExitCode()));
            $this->logger->debug(sprintf('last command (%s) output: %s', $command, $output));
        }

        if (!$process->isSuccessful()) {
            $error = sprintf("error while running %s\n output: \"%s\"", $command, $process->getErrorOutput());

            if ($this->logger) {
                $this->logger->error($error);
            }

            if ($this->debug) {
                throw new ProcessException($process);
            }

            return;
        }

        return $output;
    }
public function run($command, $args = array())
    {
        $process = $this->getProcess($command, $args);

        if ($this->logger) {
            $this->logger->info(sprintf('run command: %s "%s" ', $command, implode(' ', $args)));
            $before = microtime(true);
        }

        $process->run();

        $output = $process->getOutput();

        if ($this->logger && $this->debug) {
            $duration = microtime(true) - $before;
            $this->logger->debug(sprintf('last command (%s) duration: %sms', $command, sprintf('%.2f', $duration * 1000)));
            $this->logger->debug(sprintf('last command (%s) return code: %s', $command, $process->getExitCode()));
            $this->logger->debug(sprintf('last command (%s) output: %s', $command, $output));
        }

        if (!$process->isSuccessful()) {
            $error = sprintf("error while running %s\n output: \"%s\"", $command, $process->getErrorOutput());

            if ($this->logger) {
                $this->logger->error($error);
            }

            if ($this->debug) {
                throw new ProcessException($process);
            }

            return;
        }

        return $output;
    }
public function run ( $ command , $ args = array ( ) ) { $ process = $ this -> getProcess ( $ command , $ args ) ; if ( $ this -> logger ) { $ this -> logger -> info ( sprintf ( 'run command: %s "%s" ' , $ command , implode ( ' ' , $ args ) ) ) ; $ before = microtime ( true ) ; } $ process -> run ( ) ; $ output = $ process -> getOutput ( ) ; if ( $ this -> logger && $ this -> debug ) { $ duration = microtime ( true ) - $ before ; $ this -> logger -> debug ( sprintf ( 'last command (%s) duration: %sms' , $ command , sprintf ( '%.2f' , $ duration * 1000 ) ) ) ; $ this -> logger -> debug ( sprintf ( 'last command (%s) return code: %s' , $ command , $ process -> getExitCode ( ) ) ) ; $ this -> logger -> debug ( sprintf ( 'last command (%s) output: %s' , $ command , $ output ) ) ; } if ( ! $ process -> isSuccessful ( ) ) { $ error = sprintf ( "error while running %s\n output: \"%s\"" , $ command , $ process -> getErrorOutput ( ) ) ; if ( $ this -> logger ) { $ this -> logger -> error ( $ error ) ; } if ( $ this -> debug ) { throw new ProcessException ( $ process ) ; } return ; } return $ output ; }
This command is a facility command. You can run any command
directly on git repository.

@param string $command Git command to run (checkout, branch, tag)
@param array  $args    Arguments of git command

@return string Output of a successful process or null if execution failed and debug-mode is disabled.

@throws RuntimeException Error while executing git command (debug-mode only)
This command is a facility command . You can run any command directly on git repository .