Linux: a headless run ends on SIGTERM #601
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!601
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/headless-sigterm"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
With
HOS_HEADLESS=1,timeout 40 ./hookshotkept running past its 40 s, and only SIGKILL stopped it. The same goes for anything else that stops a run with SIGTERM, such as CI steps or service managers.Cause. The controllers start SDL even with no window (
pad_sdl.c). SDL installs SIGINT/SIGTERM handlers that turn the signal into its quit event, and only the window's event loop (display_sdl.c) reads that event. With no window the signal was swallowed.Change.
pads_startsetsSDL_NO_SIGNAL_HANDLERSbeforeSDL_InitwhenHOS_HEADLESSis set. A windowed run keeps SDL's handlers and still closes through its quit event.Tested on Ubuntu 26.04, Linux build,
timeout -k 15 12 ./hookshot:HOS_HEADLESS=1 HOS_AUDIO=0HOS_HEADLESS=1, with soundHOS_WINDOW_NOACTIVATE=1)tests/test_headless_sigterm.py(added to source-regressions) fails onmainand passes here. I haven't tried Windows.SDL_NO_SIGNAL_HANDLERSis a cross-platform SDL2 hint, and it's only set for headless runs.Assisted-by: Claude Opus 5.5