Refactor SIGINT handling for PyInstaller Linux builds#1516
Merged
maurosoria merged 2 commits intomasterfrom Feb 2, 2026
Merged
Refactor SIGINT handling for PyInstaller Linux builds#1516maurosoria merged 2 commits intomasterfrom
maurosoria merged 2 commits intomasterfrom
Conversation
- Extract magic numbers (0.8s, 3 presses) to named constants in settings.py - Add docstrings to _is_pyinstaller_linux() and signal handling methods - Extract force quit logic into dedicated _check_force_quit() method - Add helper methods _init_sigint_tracking() and _reset_sigint_tracking() - Improve inline comments for signal handling state variables https://claude.ai/code/session_01TYquHvVTvgoFzvdinTJF9K
Replace conditional platform checks with polymorphic ForceQuitHandler classes: - ForceQuitHandler: Base class defining the interface - StandardForceQuitHandler: Immediate exit on Ctrl+C during pause - PyInstallerLinuxForceQuitHandler: Multi-press detection for Linux builds Uses factory function _create_force_quit_handler() to select the right strategy at initialization, eliminating repeated platform checks. https://claude.ai/code/session_01TYquHvVTvgoFzvdinTJF9K
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.
Description
This PR refactors the SIGINT (Ctrl+C) handling logic in the Controller class to improve code maintainability and clarity, particularly for PyInstaller Linux builds which have special signal handling requirements.
What will it do?
settings.py(SIGINT_WINDOW_SECONDSandSIGINT_FORCE_QUIT_THRESHOLD)handle_pause()method by extracting force quit detection into a dedicated_check_force_quit()method_init_sigint_tracking()and_reset_sigint_tracking()for clearer intent and easier testingWhy these changes?
The original implementation had signal handling logic tightly coupled with pause handling, making it difficult to understand and maintain. The PyInstaller Linux builds require special handling for Ctrl+C due to signal delivery limitations - they need multiple rapid presses to force quit rather than a single press. These changes make that requirement explicit and configurable.
Behavior
No functional changes - the behavior remains identical:
Requirements
CONTRIBUTORS.mdCHANGELOG.mdhttps://claude.ai/code/session_01TYquHvVTvgoFzvdinTJF9K