christiaan/stream-process
Composer 安装命令:
composer require christiaan/stream-process
包简介
Wrapper around proc_open to ease communication via streams between processes
README 文档
README
Easily spawn processes and communicate with them using streams. Mainly build to be used together with react/event-loop.
Installation
composer.phar require christiaan/stream-process
Usage
$loop = \React\EventLoop\Factory::create(); $child = new StreamProcess('php someWorkerProcess.php'); $loop->addReadStream($child->getReadStream(), function($stream) { $data = fgets($stream); fwrite(STDOUT, $data); }); $loop->addPeriodicTimer(1, function() { pcntl_signal_dispatch(); }); pcntl_signal(SIGTERM, function() use($loop) { $loop->stop(); // Cleanup before closing exit(0); }); fwrite($child->getWriteStream(), 'start'); $loop->run();
Known issues
Not working on Windows because of this bug
Could possible be fixed by using files instead of direct streams.
统计信息
- 总下载量: 13.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2013-03-06