kill method

void kill(
  1. num pid, [
  2. Signal? signo
])

Send a signal to process under given pid. The value and meaning of the signal to the process is operating system and process dependant. {@linkcode 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 p = Deno.run({
 cmd: ["sleep", "10000"]
});

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

Requires allow-run permission.

Implementation

void kill(
  _i2.num pid, [
  _i4.Signal? signo,
]) {
  _i3.callMethod(
    this,
    'kill',
    [
      pid,
      signo?.name ?? _i6.undefined ?? _i6.undefined,
    ],
  );
}