Repository navigation
Take SIGHUP in tray mode so closing the terminal still runs OnStop [patch] - #55
Merged
Merged
Conversation
ShutdownSignals registered Ctrl+C and SIGTERM only, so a tray tool started from a terminal died with exit 129 when that terminal or SSH session closed: OnStop never ran and a toggle clicked inside the debounce window was lost. SIGHUP now goes through the same handler as SIGTERM, cancelled only once a tray host exists. The new test sends a real SIGHUP to the test host, with a guard registration that keeps the process alive, so a regression fails the assertion instead of crashing the run. Fixes #54 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4o1SWh5jxZ3HQXYvx
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #54
What changed
ShutdownSignalsnow registersPosixSignal.SIGHUPwith the sameOnTerminationhandler asSIGTERM. It cancels the default action only once a tray host exists, and is disposed alongside theSIGTERMregistration. The summary and remarks now say "Ctrl+C, SIGTERM and SIGHUP".ShutdownSignalsTests:HangupOnceTheTrayExists_IsTakenAndShutsTheTrayDownsends a realSIGHUPto the test host withkill -HUP(Linux/macOS only) and asserts that it reaches the tray and posts the shutdown. A guardPosixSignalRegistrationcancels the signal, so a regression fails the assertion instead of killing the test host.HangupBeforeTheTrayExists_IsLeftToEndTheProcessmirrors the existing SIGTERM case.scripts/check-tray-signals.shnow also sendsHUP. CLAUDE.md is updated to match.The console-mode SIGHUP gap (#30) is not touched here. The README's "Ctrl+C and SIGTERM" wording covers both modes, so it stays as is until #30 lands.
Verification
DesktopSessioncase.ShutdownSignals.cschange reverted,HangupOnceTheTrayExists_IsTakenAndShutsTheTrayDownfails with "SIGHUP did not reach the tray", and the test host survives.scripts/check-tray-signals.shend to end in this container. The demo's tray icon never registered with the test watcher, for the SIGTERM case as well, with and without this change, so the cause is the environment and not this diff.Generated by Claude Code