IRuntimeServices.onSignal(signal: RuntimeSignal,handler: () => void): void
Registers a handler for a process-termination signal, so an application
can run app.stop() before the process dies.
Without this, an application catching SIGTERM has to reach for
Deno.addSignalListener or process.on directly — a runtime API in
application code, which is what AI_GUIDELINES §4.2 exists to prevent, and
which forces a different entry point per target.
Absent on two platforms, for two different reasons. Cloudflare Workers
omits the key entirely: an isolate is evicted, never signalled, so there is
nothing to register for. The Deno adapter omits it on Windows, where
Deno.addSignalListener('SIGTERM') throws — so a caller must treat this as
optional (runtime.onSignal?.(…)) rather than assuming a non-edge runtime
always provides it.
Handlers are additive: registering twice for one signal runs both, in registration order. The framework never removes them — a process that has received a termination signal is ending.
signal: RuntimeSignal
The signal to listen for