From 106d3321362e94315f4ae9f58c36df35d36effb4 Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Fri, 12 Jul 2019 17:15:51 +0200 Subject: [PATCH] Catch KeyboardInterrupt so we don't barf a trace Concerns issue #1531. Future work can actually try to save state in this case, but especially with multiprocessing, that might become a bit hairy. --- overviewer.py | 3 +++ overviewer_core/dispatcher.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/overviewer.py b/overviewer.py index f549542..72a3424 100755 --- a/overviewer.py +++ b/overviewer.py @@ -659,3 +659,6 @@ See http://docs.overviewer.org/en/latest/index.html#help This is the error that occurred:""") util.nice_exit(1) + except KeyboardInterrupt: + logging.info("Interrupted by user. Aborting.") + util.nice_exit(2) diff --git a/overviewer_core/dispatcher.py b/overviewer_core/dispatcher.py index a5c3846..15293f9 100644 --- a/overviewer_core/dispatcher.py +++ b/overviewer_core/dispatcher.py @@ -261,6 +261,8 @@ class MultiprocessingDispatcherProcess(multiprocessing.Process): self.result_queue.put(result, False) except queue.Empty: pass + except KeyboardInterrupt: + return class MultiprocessingDispatcher(Dispatcher): """A subclass of Dispatcher that spawns worker processes and