diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2016-03-10 13:40:50 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2016-03-10 13:40:50 +0000 |
commit | af047f128951545af135c56d8f87ef0a924fc0ab (patch) | |
tree | bf9ee9633195369b567f57ef51bb2d02a3b02c43 | |
parent | 9fb17f2f6a4b15da66d478cb7c030d3f2daa63c8 (diff) | |
parent | 25594d554eddade86f36e7c1cc545bc4f2a0dccd (diff) |
Call exit when SIGINT is caught.
-rw-r--r-- | alot/ui.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -8,6 +8,7 @@ from twisted.internet import reactor, defer from settings import settings from buffers import BufferlistBuffer +from commands import globals from commands import commandfactory from commands import CommandCanceled from alot.commands import CommandParseError @@ -69,6 +70,7 @@ class UI(object): mainframe = urwid.Frame(urwid.SolidFill()) self.root_widget = urwid.AttrMap(mainframe, global_att) + signal.signal(signal.SIGINT, self.handle_signal) signal.signal(signal.SIGUSR1, self.handle_signal) # set up main loop @@ -650,6 +652,10 @@ class UI(object): :param signum: The signal number (see man 7 signal) :param frame: The execution frame (https://docs.python.org/2/reference/datamodel.html#frame-objects) """ + # it is a SIGINT ? + if signum == signal.SIGINT: + logging.info('shut down cleanly') + self.apply_command(globals.ExitCommand()) self.current_buffer.rebuild() self.update() |