process.py: guard signal.SIGALRM for Windows

signal.SIGALRM does not exist on Windows, so referencing it at module
import time raised AttributeError, breaking the import chain (and the
Windows PyInstaller build). Guard it with hasattr, matching the
defensive getattr pattern already used for the notify signals.

Daemonizing is not supported on Windows anyway (no os.fork), so the
empty SIGALRM list has no functional effect there.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Thomas Waldmann 2026-06-14 17:03:04 +02:00
parent d78c0f7ee1
commit 55d78e11eb
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -29,7 +29,8 @@ DAEMONIZE_NOTIFY_SIGNALS = [
# The foreground process waits for the notify signals with signal.sigwait() (which, unlike
# signal.sigtimedwait(), is also available on macOS). To still honor the timeout, we arm a
# SIGALRM timer and wait for it as well, so it must be blocked and waited for, too.
DAEMONIZE_WAIT_SIGNALS = DAEMONIZE_NOTIFY_SIGNALS + [signal.SIGALRM]
# SIGALRM is not available on Windows (where daemonizing is not supported anyway).
DAEMONIZE_WAIT_SIGNALS = DAEMONIZE_NOTIFY_SIGNALS + ([signal.SIGALRM] if hasattr(signal, "SIGALRM") else [])
@contextlib.contextmanager