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

add signal handling #209

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

add signal handling #209

wants to merge 1 commit into from

Conversation

jj-so
Copy link
Contributor

@jj-so jj-so commented Jan 29, 2024

If you start the application from a terminal and press the key combination ctrl+c in this terminal, the application will now be closed.

Closes #132

@jj-so jj-so added the feature New feature or request label Jan 29, 2024
@jj-so jj-so marked this pull request as ready for review January 29, 2024 16:13
@daringer
Copy link
Collaborator

nice, looks good, can you explain why this works now?

@jj-so
Copy link
Contributor Author

jj-so commented Jan 29, 2024

The signal.signal() function can be used to define your own handlers that are executed when a signal is received.

SIGINT is a standard handler that translates a keyboard interrupt

SIG_DFL ensures that ctrl+c is recognized to close the program

@daringer
Copy link
Collaborator

ok, also crosschecked SIG_DFL which essentially tells the kernel to handle SIGINT as is - which means that qt6 is disabling this behavior by default - ok, why not ;)

on the other side, I could test this successfully - think this should be good for now.

Could we also disable this behavior during runtime ? Means, as of now one could likely kill the nitrokeyapp during an update operation, which would brick the device - I am not sure if we should introduce this if this could happen...

@daringer daringer added this to the v2.3.0 milestone Mar 21, 2024
@daringer daringer modified the milestones: v2.3.0, v2.3.1 Apr 30, 2024
@mmerklinger mmerklinger linked an issue Jun 11, 2024 that may be closed by this pull request
@daringer daringer modified the milestones: v2.3.1, v2.3.2 Jul 16, 2024
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 this pull request may close these issues.

Handle signals properly
2 participants