mirror of
https://github.com/danog/process.git
synced 2024-12-11 16:49:40 +01:00
Fix ping-many example
This commit is contained in:
parent
fd1382fa6d
commit
a5146213ec
@ -9,13 +9,14 @@ use function Amp\Promise\all;
|
|||||||
function show_process_output(Process $process): \Generator
|
function show_process_output(Process $process): \Generator
|
||||||
{
|
{
|
||||||
$stream = $process->getStdout();
|
$stream = $process->getStdout();
|
||||||
while ($chunk = yield $stream->read()) {
|
while (null !== $chunk = yield $stream->read()) {
|
||||||
echo $chunk;
|
echo $chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
$code = yield $process->join();
|
$code = yield $process->join();
|
||||||
|
$pid = yield $process->getPid();
|
||||||
|
|
||||||
echo "Process {$process->getPid()} exited with {$code}\n";
|
echo "Process {$pid} exited with {$code}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
Amp\Loop::run(function () {
|
Amp\Loop::run(function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user