Open chobie opened 12 years ago
probably I made some mistake.
<?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( /* TODO: ENV parameter does not work linux. */ "cwd" => dirname(uv_exepath()), "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();
probably I made some mistake.