Skip to content

Commit

Permalink
Fix lambda parameter amount to allow termination on sigint / sigkill
Browse files Browse the repository at this point in the history
  • Loading branch information
xylix committed Mar 4, 2020
1 parent d4e33cf commit ea9d196
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions aw_qt/trayicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,10 @@ def run(manager: Manager, testing: bool = False) -> Any:

app = QApplication(sys.argv)

# FIXME: remove ignores after https://github.com/python/mypy/issues/2955 has been fixed
# Without this, Ctrl+C will have no effect
signal.signal(signal.SIGINT, lambda: exit(manager)) #type: ignore
# Ensure cleanup happens on SIGTERM
signal.signal(signal.SIGTERM, lambda: exit(manager)) #type: ignore
# Ensure cleanup happens on SIGTERM and SIGINT (kill and ctrl+c etc)
# The 2 un-used variables are necessary
signal.signal(signal.SIGINT, lambda _, __: exit(manager))
signal.signal(signal.SIGTERM, lambda _, __: exit(manager))

timer = QtCore.QTimer()
timer.start(100) # You may change this if you wish.
Expand Down

0 comments on commit ea9d196

Please sign in to comment.