1
0
mirror of https://github.com/danog/process.git synced 2024-11-27 04:35:02 +01:00
process/examples/002_write_command.php
2015-04-22 16:44:54 +02:00

19 lines
329 B
PHP

<?php
use Amp\Process;
include __DIR__."/../vendor/autoload.php";
\Amp\run(function() {
$proc = new Process('read ; echo "$REPLY"');
$promise = $proc->exec(Process::BUFFER_ALL);
/* send to stdin */
$proc->write("abc\n");
/* wait for process end */
$result = (yield $promise);
var_dump($result->stdout); // "abc"
});