Repository navigation
Close the main window cleanly on Ctrl+C - #149
dhairyajangir wants to merge 5 commits into
Conversation
|
Claude review on behalf of @dakejahl Verdict: merge. It routes Ctrl+C through the same Must-fix: none. Optional
Worth doing while there
|
|
Thanks for the detailed review. I reproduced the modal case with the actual GUI at this PR head on Python 3.11, PyQt 6.2.3 / Qt 6.2.4, using I also checked a possible tradeoff before changing the handler. In an isolated Qt 6.2 control using an actual Would maintainers prefer SIGINT to dismiss even an unanswered save confirmation, or should it leave that confirmation for the user? I can adjust the implementation and add regression coverage once the intended behavior is clear. The other suggestions involve separate setup, repeated-signal, inherited-handler, and child-process paths; I have not yet established a complete fix for them. Codex assisted with the investigation and tests. |
|
Thanks for pointing out the inherited With the same subprocess regression tests on Python 3.11 / Qt 6.2.4, the upstream base passed both ignored-handler cases, the previous PR head failed them, and the revised head passed all four ignored/default/custom-handler cases. The full local test selection passed 29 tests with four warnings on Python 3.11 / Qt 6.2.4 and 29 on Python 3.14 / Qt 6.12.0. An independent real-GUI loopback multicast replay also found the base and revision remained running after SIGINT when it was inherited as ignored, while the previous PR head exited; the surviving test processes were terminated afterward, so that replay is not a graceful-exit test. These are Linux local tests using reused dependencies, not hardware or upstream CI results. GitHub reports I also checked the setup-dialog suggestion without hardware: an external SIGINT sent after the actual setup dialog became visible caused a |
|
Claude review on behalf of @dakejahl Verdict: merge after one fix. The Must-fix
Optional
The other optional items from my first review need not block this PR. |
|
Thanks for catching this. I pushed An independent Linux reproduction used Python 3.11 with user-site discovery enabled and existing dependencies linked into a temporary user site: the previous PR head failed all four cases because the child could not import PyQt6, and the revision passed all four. This uses reused dependencies and is not an upstream CI or physical-adapter test. Codex assisted with the change and validation. This revision changes only the tests. The Qt modal/confirmation scope discussed above remains open, and I have not yet verified the optional externally installed native-handler case. |
|
Thanks for identifying the I pushed The added subprocess regression simulates Python reporting an unknown handler; it failed on the previous head and passed with this change. The separate native-C harness exercises the real handler case. The full local test selection passed 30 tests with four deprecation warnings on Linux, Python 3.11 / Qt 6.2.4. Tests used reused dependencies and no physical CAN adapter; they are not upstream CI or cross-platform results. The modal/save-confirmation question remains separate. Codex assisted with the fix and tests. |
|
Claude review on behalf of @dakejahl Verdict: merge. d2bf7f3 and f5cd2c2 fix the user-site import failure and the unknown-handler Must-fix: none. Optional
The Qt 6.2 modal dialog, the setup dialog and the child-process tracebacks from my earlier reviews are still open and need not block this PR. |
|
Thanks for catching the stale description. I updated it to describe when the SIGINT handler is installed and restored, and to distinguish the 30-test current-head Python 3.11 run from the earlier 29-test Python 3.14 run. The existing discussion of the other suggestions remains open. Codex assisted with the description update and this reply. |
|
Thanks for pointing out the tautological assertion. In On Linux, the complete local pytest selection passed 30 tests (four existing deprecation warnings) with Python 3.11 / PyQt 6.2.3 / Qt 6.2.4, and 30 tests with Python 3.14 / PyQt and Qt 6.12.0. Both runs used reused dependencies, disabled pytest plugin autoload and cache, and ran offscreen without a physical CAN adapter; these are not upstream CI results. I updated the description with the current-head results. The other optional signal-behavior and modal questions remain separate. Codex assisted with this test-only change and verification. |
Summary
When this code installs a SIGINT handler, queue the main-window close on Qt's event loop on SIGINT. This gives the active callback time to finish and lets the existing window and CAN-node cleanup run. The previous handler is restored when the event loop returns. An inherited ignored handler or an unknown native handler is left unchanged.
Fixes #90.
Verification
--interface mcast:0andQT_QPA_PLATFORM=offscreen. With SIGINT sent directly to the GUI process, upstream printedKeyboardInterruptfrom_spin_nodeand was still running at five seconds. The patched CLI exited with status 0 and no traceback on Python 3.11 and 3.14.ab3d92f, the complete local pytest selection passed 30 tests with four deprecation warnings on Linux, Python 3.11 / PyQt 6.2.3 / Qt 6.2.4, and 30 tests on Python 3.14 / PyQt and Qt 6.12.0. Plugin autoload and pytest cache were disabled; both runs used reused dependencies and no physical CAN adapter. These are not upstream CI results.AI assistance was used for investigation, implementation and verification.