addTimer(0.001, function (Timer $timer) use ($process, $closure, $port, &$clientData) { $process->start($timer->getLoop()); $process->stdout->on('data', function ($output) use (&$clientData) { $clientData[] = $output; }); $closure($port); }); $loop->run(); return $clientData; } }