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)); } }