From 9e7d628f7ca92ec21af0246efa29e4e030cfd90c Mon Sep 17 00:00:00 2001 From: Ajinkya Date: Fri, 2 Feb 2018 11:16:39 +0530 Subject: [PATCH] Exit peacefully on KeyboardInterrupt Captured keyboardinterrupt without traceback. Closes issue #179 --- coala_quickstart/coala_quickstart.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coala_quickstart/coala_quickstart.py b/coala_quickstart/coala_quickstart.py index 54ac369..7f087d9 100644 --- a/coala_quickstart/coala_quickstart.py +++ b/coala_quickstart/coala_quickstart.py @@ -2,6 +2,7 @@ import logging import os import sys +import signal from pyprint.ConsolePrinter import ConsolePrinter @@ -57,6 +58,10 @@ def _get_arg_parser(): return arg_parser +def signal_handler(signal, frame): + sys.exit(0) + + def main(): arg_parser = _get_arg_parser() args = arg_parser.parse_args() @@ -64,6 +69,7 @@ def main(): logging.basicConfig(stream=sys.stdout) printer = ConsolePrinter() logging.getLogger(__name__) + signal.signal(signal.SIGINT, signal_handler) fpc = None project_dir = os.getcwd()