public function run() { $onRun = $this->onRun; $createProcess = function ($cmd, $cwd = NULL, array $envs = array()) { $process = new Process($cmd, $cwd, $envs); $process->setTimeout(0); return $process; }; $onRun($this->targetProject, $createProcess); }
public function run() { $dir = $this->package->getRootDirectory(); $this->destination->create(); $gitArchive = sprintf('git archive --format=tar %s | tar xvf - --directory %s', $this->branch, $this->destination->getUnixOrCygwinPath()); $process = new Process($gitArchive, $dir, $envs = array()); $process->setTimeout(0); $log = NULL; $ret = $process->run(function ($type, $buffer) use(&$log) { $log .= $buffer; //if ('err' === $type) { // echo '[unison-ERR]: '.$buffer; //} else { // echo '[unison-OUT]: '.$buffer; //} }); if ($ret !== 0) { throw new \RuntimeException(sprintf("Cannot git archive the package.\nPackage: %s\nCmd: %s\nLog: %s\n", $this->package, $gitArchive, $log)); } }