#!/usr/bin/php list($prc, $fds, $pkg)) { $status = proc_get_status($prc); if (!$status["running"]) { array_map("fclose", $fds); proc_close($prc); if (!$status["exitcode"]) { printf("%s\t%s\n", $pkg, $dir); } unset($procs[$dir]); } } return count($procs); } while (!feof(STDIN)) { if (strlen($line = rtrim(fgets(STDIN)))) { if (list($pkg, $ver, $tgz) = explode("\t", $line)) { $dir = basename($tgz, ".tgz"); $ext = sprintf("%s/../public/phars/%s/%s-%s.ext.phar", __DIR__, $pkg, $pkg, $ver); if (!is_file($ext)) { $prc = proc_open("tar -xf $tgz --transform='s#^package\\(2\\)\\{0,1\\}\\.xml$#$dir/package.xml#' 2>&1", [ ["pipe","r"],STDERR ], $fds, __DIR__."/../build"); $procs[$dir] = [$prc, $fds, $pkg]; } check($procs); } } } while (check($procs)) { usleep(1000); }