Skip to main content
Process.kill - node__process.d.ts - Node documentation
method Process.kill

Usage in Deno

```typescript import { type Process } from "node:node__process.d.ts"; ```
Process.kill(
pid: number,
signal?: string | number,
): true
The `process.kill()` method sends the `signal` to the process identified by`pid`. Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information. This method will throw an error if the target `pid` does not exist. As a special case, a signal of `0` can be used to test for the existence of a process. Windows platforms will throw an error if the `pid` is used to kill a process group. Even though the name of this function is `process.kill()`, it is really just a signal sender, like the `kill` system call. The signal sent may do something other than kill the target process. ```js import process, { kill } from 'node:process'; process.on('SIGHUP', () => { console.log('Got SIGHUP signal.'); }); setTimeout(() => { console.log('Exiting.'); process.exit(0); }, 100); kill(process.pid, 'SIGHUP'); ``` When `SIGUSR1` is received by a Node.js process, Node.js will start the debugger. See `Signal Events`.

Parameters

pid: number
A process ID
optional
signal: string | number = 'SIGTERM'
The signal to send, either as a string or number.

Return Type

true