std/signal
2022-05-04 19:34:37 +09:00
..
mod.ts docs: add module level docs (#2190) 2022-05-04 19:34:37 +09:00
README.md [BREAKING] Remove onSignal from 'signals/' (#1644) 2021-12-13 13:50:30 +01:00
test.ts chore: update copyright header (#1871) 2022-02-02 23:21:39 +09:00

signal

signal is a module used to capture and monitor OS signals.

usage

The following functions are exposed in mod.ts:

signal

Generates an AsyncIterable which can be awaited on for one or more signals. dispose() can be called when you are finished waiting on the events.

import { signal } from "https://deno.land/std/signal/mod.ts";
const sig = signal("SIGUSR1", "SIGINT");
setTimeout(() => {}, 5000); // Prevents exiting immediately.

for await (const _ of sig) {
  // ..
}

// At some other point in your code when finished listening:
sig.dispose();