process.connected


如果 Node.js 进程使用 IPC 通道衍生(参见子进程集群文档),则只要 IPC 通道连接,process.connected 属性将返回 true,并在调用 process.disconnect() 后返回 false

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

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.

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