From e3f3c48b220180fcfe61af953abe4c6610675444 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 20:34:35 +0200 Subject: [PATCH] wrap the whole program in the try...except KeyboardInterrupt block Signed-off-by: Nico Schottelius --- bin/cdist | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/bin/cdist b/bin/cdist index 14cff65a..78893b60 100755 --- a/bin/cdist +++ b/bin/cdist @@ -20,26 +20,10 @@ # # -import argparse -import logging -import multiprocessing -import os -import re -import sys -import time - -log = logging.getLogger("cdist") - -# Ensure our /lib/ is included into PYTHON_PATH -sys.path.insert(0, os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) - -import cdist - -TYPE_PREFIX = "__" - def commandline(): """Parse command line""" + import argparse + import cdist.banner import cdist.config import cdist.install @@ -203,6 +187,23 @@ def emulator(): if __name__ == "__main__": try: + import logging + import multiprocessing + import os + import re + import sys + import time + + log = logging.getLogger("cdist") + + # Ensure our /lib/ is included into PYTHON_PATH + sys.path.insert(0, os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) + + import cdist + + TYPE_PREFIX = "__" + logging.basicConfig(format='%(levelname)s: %(message)s') if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): @@ -214,3 +215,5 @@ if __name__ == "__main__": sys.exit(0) sys.exit(0) + +