Skip to content

feat(async): owned eagerly registered Ctrl+C notifications #187

Closed

Description

@zackees

Gap

FastLED still calls tokio::signal::ctrl_c directly in commands.rs and test_mode.rs. The existing process ShutdownRequest installer is not equivalent: it also handles SIGTERM, is process-global and polled, and replaces native handlers. async_engine currently has no facade-owned interrupt listener.

Proposed contract

Add an eagerly registered Ctrl+C-only listener obtained from an owned kernel Runtime. The runtime records whether its I/O/signal drivers were enabled, so requesting this facility without them returns Unsupported instead of invoking a backend panic. A listener borrows that runtime, uses the existing private Tokio signal driver, and exposes a cancellation-safe async wait with facade-owned errors. Unix SIGINT and Windows CTRL_C are native implementations selected by the existing host boundary; no second runtime, signal stack, dependency or proc-macro crate.

Signals may coalesce; this is shutdown notification, not counting. Registration affects process-wide signal handling and dropping a listener does not restore default handlers. Native registration failures and closed receivers are errors. Applications own exit status, repeated-interrupt policy and resource cleanup.

Acceptance

  • RED missing API, then GREEN registration precondition and isolated subprocess native delivery tests.
  • Verify registration before first wait, wait cancellation followed by later delivery, multiple listeners, and repeated delivery after acknowledgement.
  • Unix tests signal only an isolated child; Windows child owns a fresh console before generating CTRL_C; parent imposes a deadline and kills/reaps a hung child.
  • Default feature useful, no backend types in public signatures, strict lint and supported-target checks.
  • Adopt from FastLED, removing direct signal calls; remaining select/test macro migration is tracked separately.
  • Publish usable exact release and consume it without migration-only path overrides.

Coordinated with FastLED/cli#242; refs #155 and FastLED/cli#229. Judgment: obtain listeners from Runtime rather than ambient context to make driver capability and lifetime explicit.

Activity

  1. zackees commented on Sep 16, 2026

    @zackees
    CollaboratorAuthor

    Complete and adopted; closing with the evidence rather than leaving it open.

    kernal-api — landed in f6e5cd0, with tests/interrupt_notification.rs and docs/interrupt-notifications.md. Verified present on main rather than inferred from the commit message alone.

    FastLED — the async runtime path the application already consumes through the facade.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions