当我生成如下所示的子进程时,执行的节点文件中的await new userProfileModel({
userId,
userFirstName,
userLastName,
userCoordinates,
})
.save()
.then(() => {
console.log('it worked!');
res.send('worked!');
})
.catch((error) => {
console.log('did not worl')
// console.log(error);
});
未定义。
process.send
如果我不使用npm运行脚本直接按以下方式执行节点文件,则spawn("npm", ["run", "test"], {
cwd: testPath,
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
env: {
...process.env,
...env
}
});
可以正常工作。可以将其与运行脚本一起使用吗?
process.send