1
0
mirror of https://github.com/danog/process.git synced 2024-11-27 04:35:02 +01:00
process/examples/watch-live.php
2017-06-15 12:11:38 -05:00

18 lines
391 B
PHP

<?php
include dirname(__DIR__) . "/vendor/autoload.php";
use Amp\Process\StreamedProcess;
Amp\Loop::run(function () {
$process = new StreamedProcess("echo 1; sleep 1; echo 2; sleep 1; echo 3; exit 42");
$process->start();
while ($chunk = yield $process->read()) {
echo $chunk;
}
$code = yield $process->join();
echo "Process exited with {$code}.\n";
});