process.connected


如果 Node.js 进程是由 IPC 通道(参见子进程集群的文档)的方式创建,则只要 IPC 通道保持连接, process.connected 属性就会返回 trueprocess.disconnect() 被调用后,此属性会返回 false

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

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().