From aa6d3991e5a0eabb6a42d819d5a1235a39682e18 Mon Sep 17 00:00:00 2001 From: Ajinkya Date: Sat, 3 Feb 2018 16:24:30 +0530 Subject: [PATCH] Exit peacefully on KeyboardInterrupt Captured keyboardinterrupt without traceback. Closes #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..7cca6de 100644 --- a/coala_quickstart/coala_quickstart.py +++ b/coala_quickstart/coala_quickstart.py @@ -1,6 +1,7 @@ import argparse import logging import os +import signal import sys from pyprint.ConsolePrinter import ConsolePrinter @@ -57,6 +58,10 @@ def _get_arg_parser(): return arg_parser +def signal_handler(self, cls): + 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()