Skip to content

hal, gmoccapy: a SIGTERM during startup no longer leaves the GUI running - #4532

Open
grandixximo wants to merge 2 commits into
LinuxCNC:masterfrom
grandixximo:gmoccapy-sigterm
Open

grandixximo wants to merge 2 commits into
LinuxCNC:masterfrom
grandixximo:gmoccapy-sigterm

Conversation

@grandixximo

@grandixximo grandixximo commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #4506 for the remaining ui-smoke/gmoccapy-quit failures in #4500.

import hal sets SIGTERM to default_int_handler unconditionally, replacing the startup handler #4506 installs. A SIGTERM during construction then raises KeyboardInterrupt wherever the constructor happens to be; inside a bare except: 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 bare except: swallows the startup handler's SystemExit just 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 catches Exception instead of BaseException.

tests/ui-smoke/gmoccapy-quit passes locally, also under load.

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.
Comment thread src/emc/usr_intf/gmoccapy/gmoccapy.py Outdated
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.
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.

2 participants