In PHP, is there a way to have a child process forked off with pcntl_fork()
write data directly back to its parent's stdin? I don't mean w开发者_开发知识库ith a separate pipe--the stdin resource itself? (It has to be stdin because, in short, what the parent is doing won't work right unless it can bind its own stdin to incoming data directly--a separate pipe won't work.) As in:
$pid = pcntl_fork();
if (!$pid) {
// do fun child process stuff
// write data back to parent's STDIN
}
On Linux (don't know how prevalent this would be for Unix in general), a process' stdin can be gotten at via /proc/$PID/fd/0
(as well as stdout/stderr at 1 & 2 rather than 0)
精彩评论