Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.ns.d.ts>Deno.kill

A modern runtime for JavaScript and TypeScript.
Latest
function Deno.kill
allow-run
import { Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.ns.d.ts";
const { kill } = Deno;

Send a signal to process under given pid. The value and meaning of the signal to the process is operating system and process dependant. Signal provides the most common signals. Default signal is "SIGTERM".

The term kill is adopted from the UNIX-like command line command kill which also signals processes.

If pid is negative, the signal will be sent to the process group identified by pid. An error will be thrown if a negative pid is used on Windows.

const command = new Deno.Command("sleep", { args: ["10000"] });
const child = command.spawn();

Deno.kill(child.pid, "SIGINT");

Requires allow-run permission.

Parameters

pid: number
optional
signo: Signal