process.disconnect()


如果 Node.js 进程是使用 IPC 通道生成的(请参阅 子进程集群 文档),process.disconnect() 方法将关闭到父进程的 IPC 通道,允许子进程在没有其他连接保持活动时正常退出 .

¥If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the process.disconnect() method will close the IPC channel to the parent process, allowing the child process to exit gracefully once there are no other connections keeping it alive.

调用 process.disconnect() 的效果和从父进程调用 ChildProcess.disconnect() 是一样的。

¥The effect of calling process.disconnect() is the same as calling ChildProcess.disconnect() from the parent process.

如果 Node.js 进程不是使用 IPC 通道衍生,则 process.disconnect() 将是 undefined

¥If the Node.js process was not spawned with an IPC channel, process.disconnect() will be undefined.