protected function gatherOutput(array $processes, Closure $callback)
{
foreach ($processes as $host => $process) {
$methods = [Process::OUT => 'getIncrementalOutput', Process::ERR => 'getIncrementalErrorOutput'];
foreach ($methods as $type => $method) {
$output = $process->{$method}();
if (!empty($output)) {
$callback($type, $host, $output);
}
}
}
}