Cleanly exit on SIGINT otherwise python3 will leave the terminal in an
authorGuillaume Chazarain <guichaz@gmail.com>
Sun, 26 May 2013 16:52:48 +0000 (26 18:52 +0200)
committerGuillaume Chazarain <guichaz@gmail.com>
Sun, 26 May 2013 17:02:09 +0000 (26 19:02 +0200)
unusable state.

iotop/ui.py

index 72ed7d7..a104114 100644 (file)
@@ -483,6 +483,8 @@ class IOTopUI(object):
 def run_iotop_window(win, options):
     if options.batch:
         signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+    else:
+        signal.signal(signal.SIGINT, lambda *args, **kwargs: sys.exit(0))
     taskstats_connection = TaskStatsNetlink(options)
     process_list = ProcessList(taskstats_connection, options)
     ui = IOTopUI(win, process_list, options)