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,就无法再通过 IPC 通道使用 process.send() 发送消息。

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