我在创建 chlid 进程时传递参数
if (cluster.isMaster) {
for (var i = 0; i < os.cpus().length; i++) {
var new_worker_env = {};
new_worker_env["WORKER_NAME"] = "worker" + i;
var new_worker = cluster.fork(new_worker_env);
}
}
然后尝试在孩子中阅读它:
if ( process.env["WORKER_NAME"] != undefined ) instance.name = process.env["WORKER_NAME"];
但是这个变量不存在,为什么?
节点 v0.8.8