ext-uv/tests/800-uv_spawn.phpt

34 lines
688 B
Plaintext
Raw Normal View History

2012-06-30 06:08:23 +02:00
--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 ";
2012-07-01 05:40:02 +02:00
/* TODO: ENV parameter does not work linux. */
$process = uv_spawn(uv_default_loop(), "php", array('-r','echo "WORLD";'), array(
2012-07-01 01:42:50 +02:00
"cwd" => dirname(uv_exepath()),
2012-06-30 06:08:23 +02:00
"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, $nread, $buffer){
2012-06-30 06:08:23 +02:00
echo $buffer . PHP_EOL;
uv_close($out,function(){});
});
uv_run();
--EXPECT--
HELLO WORLD