Skip to main content
Worker.prototype.kill - cluster - Node documentation
method Worker.prototype.kill

Usage in Deno

import { Worker } from "node:cluster";
Worker.prototype.kill(signal?: string): void

This function will kill the worker. In the primary worker, it does this by disconnecting the worker.process, and once disconnected, killing with signal. In the worker, it does it by killing the process with signal.

The kill() function kills the worker process without waiting for a graceful disconnect, it has the same behavior as worker.process.kill().

This method is aliased as worker.destroy() for backwards compatibility.

In a worker, process.kill() exists, but it is not this function; it is kill().

Parameters

optional
signal: string = 'SIGTERM'

Name of the kill signal to send to the worker process.

Return Type

void