1
0
mirror of https://github.com/danog/process.git synced 2025-01-22 05:41:17 +01:00
process/example/basic-command.php

16 lines
354 B
PHP
Raw Normal View History

<?php
include dirname(__DIR__) . "/vendor/autoload.php";
2017-01-15 09:30:34 -06:00
use Amp\Process\StreamedProcess;
AsyncInterop\Loop::execute(Amp\wrap(function() {
2017-01-15 09:30:34 -06:00
$process = new StreamedProcess("echo 'Hello, world!'");
$promise = $process->execute();
2017-01-15 09:30:34 -06:00
echo yield $process->getStdout();
2017-01-15 09:30:34 -06:00
$code = yield $promise;
echo "Process exited with {$code}.\n";
}));