Add SIGHUP cleanup handling #55

Merged
JackFrostbyte merged 1 commit from fix/issue-46-add-sighup-cleanup into develop 2026-05-15 17:14:53 -04:00
Collaborator

Summary

  • Registers SIGHUP with the existing _request_stop handler so a manual terminal session closing (or an SSH disconnect) triggers the same clean shutdown path as SIGTERM.
  • Stores and restores the previous SIGHUP handler in the finally block alongside the existing SIGTERM restore.
  • Guards the registration and restore with hasattr(signal, "SIGHUP") so the runtime stays safe on platforms where SIGHUP doesn't exist (e.g. Windows).
  • Does not change behavior for SIGTERM, KeyboardInterrupt, or systemd-driven service shutdowns.

Verification

  • ruff format src tests scripts — 29 files left unchanged.
  • ruff check src tests scripts — all checks passed.
  • python -m pytest tests/ — 1 passed (the existing _signal_handler_startup_failure regression test from #45 still passes).
  • python -m rgb_aura.main --dry-run --dry-run-events 3 — clean run, all 14 animations registered, scheduler preview produces events normally.

Hardware verification

Not required. Signal handling only; no LED write-path changes, no device mapping changes, no animation changes.

Linked issue

Closes #46.

Branch workflow

  • Base branch: develop
  • Work branch: fix/issue-46-add-sighup-cleanup
  • Pull request target: develop
  • Not merged directly into main.
## Summary - Registers `SIGHUP` with the existing `_request_stop` handler so a manual terminal session closing (or an SSH disconnect) triggers the same clean shutdown path as `SIGTERM`. - Stores and restores the previous `SIGHUP` handler in the `finally` block alongside the existing `SIGTERM` restore. - Guards the registration and restore with `hasattr(signal, "SIGHUP")` so the runtime stays safe on platforms where `SIGHUP` doesn't exist (e.g. Windows). - Does not change behavior for `SIGTERM`, `KeyboardInterrupt`, or systemd-driven service shutdowns. ## Verification - [x] `ruff format src tests scripts` — 29 files left unchanged. - [x] `ruff check src tests scripts` — all checks passed. - [x] `python -m pytest tests/` — 1 passed (the existing `_signal_handler_startup_failure` regression test from #45 still passes). - [x] `python -m rgb_aura.main --dry-run --dry-run-events 3` — clean run, all 14 animations registered, scheduler preview produces events normally. ## Hardware verification Not required. Signal handling only; no LED write-path changes, no device mapping changes, no animation changes. ## Linked issue Closes #46. ## Branch workflow - Base branch: `develop` - Work branch: `fix/issue-46-add-sighup-cleanup` - Pull request target: `develop` - Not merged directly into `main`.
JackFrostbyte deleted branch fix/issue-46-add-sighup-cleanup 2026-05-15 17:14:53 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JackFrostbyte/rgb-aura!55
No description provided.