mirror of
https://github.com/danog/process.git
synced 2024-12-12 09:09:44 +01:00
19 lines
405 B
PHP
19 lines
405 B
PHP
<?php
|
|
|
|
include dirname(__DIR__) . "/vendor/autoload.php";
|
|
|
|
use Amp\ByteStream\Message;
|
|
use Amp\Process\Process;
|
|
|
|
Amp\Loop::run(function () {
|
|
$process = yield Process::start('read ; echo "$REPLY"');
|
|
|
|
/* send to stdin */
|
|
$process->getStdin()->write("abc\n");
|
|
|
|
echo yield new Message($process->getStdout());
|
|
|
|
$code = yield $process->join();
|
|
echo "Process exited with {$code}.\n";
|
|
});
|