Liip\RMT\VCS\Git::executeGitCommand PHP Method

executeGitCommand() protected method

protected executeGitCommand ( $cmd )
    protected function executeGitCommand($cmd)
    {
        // Avoid using some commands in dry mode
        if ($this->dryRun) {
            if ($cmd !== 'tag') {
                $cmdWords = explode(' ', $cmd);
                if (in_array($cmdWords[0], array('tag', 'push', 'add', 'commit'))) {
                    return;
                }
            }
        }
        // Execute
        $cmd = 'git ' . $cmd;
        exec($cmd, $result, $exitCode);
        if ($exitCode !== 0) {
            throw new \Liip\RMT\Exception('Error while executing git command: ' . $cmd . "\n" . implode("\n", $result));
        }
        return $result;
    }