ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Server.Halt

Description

The local-development immediate-halt wiring: an interactive session's "quit now" key, inert outside a terminal. Ecluse.Runtime.Server's runWarp wraps the whole run in withInteractiveHalt.

Synopsis

Documentation

data InteractiveHalt Source #

The local-development immediate-halt wiring, as injection points a test drives without a terminal. Ctrl-D exits the process at once and aborts the drain. It is inert on a non-TTY.

Constructors

InteractiveHalt 

Fields

  • haltOnInteractive :: IO Bool

    Whether to arm the halt. A non-interactive process never installs the watcher.

  • awaitHaltSignal :: IO ()

    Block until the dev's halt signal. The real wiring reads standard input until end-of-input (Ctrl-D). It returns when the watcher should fire.

  • halt :: IO ()

    Stop the process immediately, bypassing the drain wait. The real wiring is a direct _exit (exitImmediately).

defaultInteractiveHalt :: InteractiveHalt Source #

The real local-dev halt: armed only on a terminal and fired by end-of-input, exiting at once without a drain. Status 130 is the conventional "terminated from the terminal" code.

withInteractiveHalt :: InteractiveHalt -> IO a -> IO a Source #

Run an action with the immediate-halt watcher armed only when haltOnInteractive is True. The watcher lives exactly as long as the action, so it never outlives it.