Skip to content

Let a repeated Ctrl+C, SIGTERM or SIGHUP end a run whose shutdown hangs [patch] - #66

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/repeated-signal-forces-exit
Nov 4, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
claude/repeated-signal-forces-exit

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #63

What changed

Tray mode. ShutdownSignals.RequestShutdown now returns what TrayApplication.RequestShutdown returned, so only the signal that posts the shutdown is cancelled. A repeated Ctrl+C / SIGTERM / SIGHUP, or one after the Quit item already posted the shutdown, gets its default handling and ends the process. A blocked UI thread or a hung OnStop can be interrupted again without SIGKILL.

Console mode. ConsoleRunner uses a small internal StopRequest. Only the first Ctrl+C / SIGTERM is cancelled. The request is closed before OnStop runs, whatever ended the wait (signal or --for expiry), so a SIGTERM during a hung OnStop ends the process.

A single signal still ends the run through OnStop and the preference flush, as #21 / #52 / #55 intended.

Tests

  • ARepeatedSignal_IsStillTakenButPostsNoSecondShutdown is renamed to ARepeatedSignal_IsLeftToEndTheProcessAndPostsNoSecondShutdown. The second request is now expected to return false.
  • New ARepeatedTermination_IsNotCancelled and ASignalAfterQuit_IsNotCancelled.
  • New StopRequest_TakesOnlyTheFirstRequest and StopRequest_AfterTheRunStopsOnItsOwn_TakesNoRequest.

With the old behavior restored, all five fail. With the fix, the full suite passes (164 passed, 1 skipped), and the Release build is clean.

scripts/check-tray-signals.sh could not be run in the container I used. The demo fails before the change too, with "Unable to load bitmap from provided data" under Xvfb, so the result says nothing about this change. Please run it on a desktop before merging.


Generated by Claude Code

…gs [patch]

ShutdownSignals cancelled every signal once a tray existed, and ConsoleRunner
cancelled every Ctrl+C and SIGTERM, including one sent while OnStop ran. A
blocked UI thread or a hung OnStop then left nothing short of SIGKILL to end
the process. Only the signal that starts the shutdown is taken now; a repeated
one, one after Quit, or one during a console run's OnStop gets its default
handling.

Fixes #63

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW4brDwN4YAzA6oCKV6
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A tray run whose UI thread or OnStop hangs can only be stopped with SIGKILL: every repeated Ctrl+C, SIGTERM and SIGHUP is cancelled and does nothing

2 participants