Handle OS Signals

    • Use the flag to access new or unstable features in Deno.
    • Deno.addSignalListener() can be used to capture and monitor OS signals.

    APIs for handling OS signals are modelled after already familiar and removeEventListener APIs.

    You can use function for handling OS signals:

    Run with:

    1. deno run --unstable add_signal_listener.ts

    Run with:

    If you prefer to handle signals using an async iterator, you can use API available in deno_std: