/** * run a git command inside a local Git repository * * @param string $repoDir * the location of the Git repo * @param array|Traversable $command * the command to run * @param EventStream|null $eventStream * the (optional) stream to send events to * @return ProcessResult * the result of running the command */ public static function run($repoDir, $command, EventStream $eventStream = null) { // defensive programming! RequireGitRepo::check($repoDir); // run the command return PopenProcessRunner::run($command, null, $repoDir, $eventStream); }
/** * call /usr/bin/sw_vers and return the output * * @param string $pathToBinary * path to the binary to call * @return string|null * output from the binary */ private static function getOutputFromBinary($pathToBinary) { // make sure we have an executable binary if (!IsExecutableFile::check($pathToBinary)) { return null; } // get the info $result = PopenProcessRunner::run([$pathToBinary]); if ($result->getReturnCode() !== 0) { return null; } // at this point, return the output return $result->getOutput(); }