backend/components/AGitRepository.php
/**
	 * Runs a git command and returns the response
	 * @throws AGitException if git returns an error
	 * @param string $command the git command to run
	 * @return string the response from git
	 */
Runs a git command and returns the response
@throws AGitException if git returns an error
@param string $command the git command to run
@return string the response from git
Runs a git command and returns the response @throws AGitException if git returns an error @param string $command the git command to run @return string the response from git
public function run($command)
	{
		$descriptor = array(
			1 => array('pipe', 'w'),
			2 => array('pipe', 'w'),
		);
		$pipes = array();
		$resource = proc_open($this->gitPath." ".$command,$descriptor,$pipes,$this->getPath());
		$stdout = stream_get_contents($pipes[1]);
		$stderr = stream_get_contents($pipes[2]);
		foreach($pipes as $pipe) {
			fclose($pipe);
		}
		if (trim(proc_close($resource)) && $stderr) {
			throw new AGitException($stderr);
		}
		return trim($stdout);
	}
public function run ( $ command ) { $ descriptor = array ( 1 => array ( 'pipe' , 'w' ) , 2 => array ( 'pipe' , 'w' ) , ) ; $ pipes = array ( ) ; $ resource = proc_open ( $ this -> gitPath . " " . $ command , $ descriptor , $ pipes , $ this -> getPath ( ) ) ; $ stdout = stream_get_contents ( $ pipes [ 1 ] ) ; $ stderr = stream_get_contents ( $ pipes [ 2 ] ) ; foreach ( $ pipes as $ pipe ) { fclose ( $ pipe ) ; } if ( trim ( proc_close ( $ resource ) ) && $ stderr ) { throw new AGitException ( $ stderr ) ; } return trim ( $ stdout ) ; }
Runs a git command and returns the response
 @throws AGitException if git returns an error
 @param string $command the git command to run
 @return string the response from git
Runs a git command and returns the response @throws AGitException if git returns an error @param string $command the git command to run @return string the response from git