2012-06-14 15:29:16 +02:00
|
|
|
<?php
|
|
|
|
|
2012-07-22 14:54:19 +02:00
|
|
|
$in = uv_pipe_init(uv_default_loop(), true);
|
|
|
|
$out = uv_pipe_init(uv_default_loop(), true);
|
|
|
|
|
|
|
|
echo "HELLO ";
|
|
|
|
|
|
|
|
$stdio = array();
|
|
|
|
$stdio[] = uv_stdio_new($in, UV::CREATE_PIPE | UV::READABLE_PIPE);
|
|
|
|
$stdio[] = uv_stdio_new($out, UV::CREATE_PIPE | UV::WRITABLE_PIPE);
|
|
|
|
|
|
|
|
$flags = 0;
|
2012-07-22 17:08:05 +02:00
|
|
|
uv_spawn(uv_default_loop(), "php", array('-r','var_dump($_ENV);'), $stdio, "/usr/bin/",
|
2012-07-23 18:00:37 +02:00
|
|
|
array("KEY"=>"hello"),
|
2012-07-22 14:54:19 +02:00
|
|
|
function($process, $stat, $signal){
|
|
|
|
uv_close($process,function(){});
|
2012-06-14 15:29:16 +02:00
|
|
|
|
2012-07-22 14:54:19 +02:00
|
|
|
}, $flags);
|
2012-06-24 18:29:22 +02:00
|
|
|
|
2012-07-22 14:54:19 +02:00
|
|
|
uv_read2_start($out, function($out, $nread, $buffer, $stat){
|
|
|
|
echo $buffer;
|
2012-06-14 15:29:16 +02:00
|
|
|
|
2012-07-22 14:54:19 +02:00
|
|
|
uv_close($out,function(){});
|
2012-06-14 15:29:16 +02:00
|
|
|
});
|
|
|
|
|
2012-07-23 18:00:37 +02:00
|
|
|
uv_run();
|