hal, gmoccapy: a SIGTERM during startup no longer leaves the GUI running - #4532
Open
grandixximo wants to merge 2 commits into
Open
grandixximo wants to merge 2 commits into
grandixximo wants to merge 2 commits into
Conversation
Importing _hal points SIGTERM at default_int_handler, so that a halcmd unload interrupts a component. It did so unconditionally, replacing a handler the program had already installed; only take the signal when nobody has.
BsAtHome
reviewed
Sep 14, 2026
The SystemExit it raises surfaces at whatever statement the constructor is on, and a bare except there swallows it, after which the GUI runs on with nobody asking again. Have the handler record the request and act on it in the two places the process can end up afterwards: main() exits once construction returns, and the excepthook exits instead of showing its dialog, since a half-built object left behind by the swallowed exit tends to fail a few statements later. Both are ordinary exits with the exit handlers run. The icon loader catches Exception rather than BaseException.
grandixximo
force-pushed
the
gmoccapy-sigterm
branch
from
September 14, 2026 12:50
f6783dd to
5b27a22
Compare
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.
Follow-up to #4506 for the remaining
ui-smoke/gmoccapy-quitfailures in #4500.import halsets SIGTERM todefault_int_handlerunconditionally, replacing the startup handler #4506 installs. A SIGTERM during construction then raises KeyboardInterrupt wherever the constructor happens to be; inside a bareexcept:it is swallowed, construction finishes, and the GUI runs on. Under load construction is slow enough for the test's SIGTERM to land there.hal: only set SIGTERM when the program has no handler of its own. Components are unchanged, they never set one.gmoccapy: a bareexcept:swallows the startup handler'sSystemExitjust as well, so the handler records the request in a flag and main() exits on it once construction returns. The excepthook exits on the flag too, instead of showing its dialog: a swallowed exit can leave a half-built object behind whose next use fails. Both are ordinary exits with the exit handlers run. The icon loader catchesExceptioninstead ofBaseException.tests/ui-smoke/gmoccapy-quitpasses locally, also under load.