std@0.144.0/signal

Deno standard library
GitHub Stars
2196
Go to latest
import * as mod from "https://deno.land/std@0.144.0/signal/mod.ts";

High level API for dealing with OS signals.

Functions

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.

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();