execute(); $stdout = $process->getStdout(); while (yield $stdout->advance()) { echo $stdout->getCurrent(); } $code = yield $promise; echo "Process exited with {$code}.\n"; }));