mirror of
https://github.com/danog/process.git
synced 2025-01-07 13:18:40 +01:00
19 lines
386 B
PHP
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";
|
|
});
|