Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle signals properly #132

Open
daringer opened this issue Jul 18, 2023 · 1 comment · May be fixed by #209
Open

Handle signals properly #132

daringer opened this issue Jul 18, 2023 · 1 comment · May be fixed by #209
Assignees
Labels
feature New feature or request

Comments

@daringer
Copy link
Collaborator

The TERMINATE (ctrl+c?) signal is not handled correctly, it should gracefully close the application

To reproduce: start the application from a terminal and press ctrl+c inside this terminal, the application should close, but it just ignores the signal. Only KILL works...

@robin-nitrokey
Copy link
Member

https://stackoverflow.com/questions/4938723/what-is-the-correct-way-to-make-my-pyqt-application-quit-when-killed-from-the-co

Python cannot handle signals while the Qt event loop is running. Only when the Python interpreter run (when the QApplication quits, or when a Python function is called from Qt) the signal handler will be called.

Fixes:

  • signal.signal(signal.SIGINT, signal.SIG_DFL) to just close without cleanup
  • occasionally yield to the Python interpreter for signal processing

@mmerklinger mmerklinger added the feature New feature or request label Nov 10, 2023
@jj-so jj-so linked a pull request Jan 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants