Skip to main content
ChildProcess.prototype.disconnect - child_process - Node documentation
method ChildProcess.prototype.disconnect

Usage in Deno

import { ChildProcess } from "node:child_process";
ChildProcess.prototype.disconnect(): void

Closes the IPC channel between parent and child, allowing the child to exit gracefully once there are no other connections keeping it alive. After calling this method the subprocess.connected and process.connected properties in both the parent and child (respectively) will be set to false, and it will be no longer possible to pass messages between the processes.

The 'disconnect' event will be emitted when there are no messages in the process of being received. This will most often be triggered immediately after calling subprocess.disconnect().

When the child process is a Node.js instance (e.g. spawned using fork), the process.disconnect() method can be invoked within the child process to close the IPC channel as well.

Return Type

void
Back to top