gpt4 book ai didi

node.js 子 fork 进程编码

转载 作者:搜寻专家 更新时间:2023-11-01 00:46:03 25 4
gpt4 key购买 nike

向 node.js 中的 fork 子进程发送特殊字符(如 ß)不起作用。看起来子进程无法读取它。

我可以在一个非常简单的示例中展示它,我将一个字符 (“ß”) 发送到 fork 进程并返回。

父进程

var child = fork("render.js");

child.on('message', function (m) {
res.send(m);
});

//this does not work, works fine with normal 's'
child.send("ß");

setTimeout(function () {
child.kill();
res.send("Timeout error");
}, 5000);

然后子进程

process.on('message', function (m) {    
process.send(m)
process.exit();
});

为了完整起见,我在 IIS 中托管 Node 。

最佳答案

那是一个bug在提到的 Node 中 here .不适用于 0.10.1 版。将 Node 更新到最新的 0.10.5 为我修复了它。

关于node.js 子 fork 进程编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16274707/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com