@flowscripter/dynamic-cli-framework
    Preparing search index...

    Interface ShutdownService

    Service allowing registration of prioritised tasks to run during CLI shutdown.

    interface ShutdownService {
        isShutdownRequested: boolean;
        enterLongRunningMode(): void;
        interrupt(): void;
        leaveLongRunningMode(): void;
        registerTask(task: ShutdownTask): void;
    }

    Implemented by

    Index
    isShutdownRequested: boolean

    True once shutdown has been requested (e.g. first Ctrl-C in long-running mode).

    • Enter long-running mode where the first Ctrl-C sets a cooperative flag instead of exiting, and a third Ctrl-C forces exit.

      Returns void

    • Handle a user interrupt (e.g. Ctrl-C read as a key press while the terminal is in raw mode), with the same behavior as receiving SIGINT: outside long-running mode, run the shutdown tasks and exit; in long-running mode, set isShutdownRequested, with a third interrupt forcing exit.

      Returns void

    • Leave long-running mode, restoring default single Ctrl-C exit behavior.

      Returns void

    • Register a ShutdownTask to run during graceful shutdown.

      Parameters

      Returns void