process.connected


如果 Node.js 进程是使用 IPC 通道生成的(请参阅 子进程集群 文档),只要连接了 IPC 通道,process.connected 属性就会返回 true,并在调用 process.disconnect() 后返回 false

¥If the Node.js process is spawned with an IPC channel (see the Child Process and Cluster documentation), the process.connected property will return true so long as the IPC channel is connected and will return false after process.disconnect() is called.

一旦 process.connectedfalse,就不能再使用 process.send() 通过 IPC 通道发送消息。

¥Once process.connected is false, it is no longer possible to send messages over the IPC channel using process.send().