mirror of
https://github.com/danog/process.git
synced 2024-12-11 16:49:40 +01:00
19 lines
411 B
PHP
19 lines
411 B
PHP
<?php
|
|
|
|
include dirname(__DIR__) . "/vendor/autoload.php";
|
|
|
|
use Amp\Process\Process;
|
|
|
|
Amp\Loop::run(function () {
|
|
$process = new Process("echo 1; sleep 1; echo 2; sleep 1; echo 3; exit 42");
|
|
$process->start();
|
|
|
|
$stream = $process->getStdout();
|
|
while ($chunk = yield $stream->read()) {
|
|
echo $chunk;
|
|
}
|
|
|
|
$code = yield $process->join();
|
|
echo "Process exited with {$code}.\n";
|
|
});
|