Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion examples/tutorials/os_signals.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ oldUrl:
- /runtime/tutorials/os_signals/
---

> ⚠️ Windows only supports listening for SIGINT and SIGBREAK as of Deno v1.23.
> ⚠️ Windows supports listening for `SIGINT`, `SIGBREAK`, `SIGTERM`, and
> `SIGQUIT` (the latter two via libuv's Windows signal emulation).

## Concepts

Expand Down Expand Up @@ -75,3 +76,18 @@ Run with:
```shell
deno run signal_listeners.ts
```

## Windows support

The supported signal set differs between platforms. The Windows-specific
behavior is:

| Use case | Supported signals on Windows |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `Deno.addSignalListener(sig, …)` | `SIGINT`, `SIGBREAK`, `SIGTERM`, `SIGQUIT` |
| `Deno.kill(pid, sig)` | `SIGINT`, `SIGBREAK`, `SIGTERM`, `SIGQUIT`, `SIGKILL`, `SIGABRT`, plus signal `0` for a process-health check |

`SIGKILL` and `SIGABRT` are deliberately **not** registerable via
`addSignalListener` — they're uncatchable / fatal, matching Unix semantics. On
Windows the catchable signals all forward to libuv's emulation layer; signals
sent via `Deno.kill` ultimately invoke `TerminateProcess`.
Loading