В parent.js
child = fork(filePath,[],{silent : true});
child.send({
msgtype: "path",
path: path,
options: options,
});
child.stdout.on("data",(data)=>{
console.log(data);
})
в дочернем process.js
let createQueue = require("queue-async");
let readdirp = require("readdirp");
process.on("message", function(msg) {
let files = "";
if (msg && msg.msgtype === "path") {
let pathname = msg.path;
files = readdirp(pathname);
process.send({
msg: "detials",
details: msg
});
files.on("error", e => {
process.send({
msg: "killMe",
details: null
});
});
files.on("end", () => {
process.send({
msg: "killMe",
details: null
});
});
files.pipe(process.stdout)
}
});
Моя проблема, у меня нет ошибок, и дочерний процесс не завершен.
Но child.stdout.on("data")
не запускается, я не знаю, что происходит в фоновом режиме.
Почему я не могу получить данные от ребенка ??Что мне не хватает, может кто-нибудь помочь, пожалуйста ??