1
0
mirror of https://github.com/danog/process.git synced 2025-01-07 13:18:40 +01:00
process/example/write-command.php
2017-03-16 10:04:52 -05:00

19 lines
386 B
PHP

<?php
include dirname(__DIR__) . "/vendor/autoload.php";
use Amp\Process\StreamedProcess;
Amp\Loop::run(function() {
$process = new StreamedProcess('read ; echo "$REPLY"');
$promise = $process->execute();
/* send to stdin */
$process->write("abc\n");
echo yield $process->getStdout();
$code = yield $promise;
echo "Process exited with {$code}.\n";
});