ext-uv/tests/800-uv_spawn.phpt
2012-07-01 01:57:08 +09:00

33 lines
636 B
PHP

--TEST--
Check for uv_spawn
--FILE--
<?php
$in = uv_pipe_init(uv_default_loop(), 1);
$out = uv_pipe_init(uv_default_loop(), 1);
echo "HELLO ";
$process = uv_spawn(uv_default_loop(), "php", array('-r','echo $_ENV["HELLO"];'), array(
"cwd" => "/usr/bin/",
"pipes" => array(
$in,
$out,
),
"env" => array(
"KEY" => "VALUE",
"HELLO" => "WORLD",
)
),function($process, $stat, $signal) use ($out){
uv_close($process,function(){
});
});
uv_read_start($out, function($out, $buffer,$stat){
echo $buffer . PHP_EOL;
uv_close($out,function(){});
});
uv_run();
--EXPECT--
HELLO WORLD