wrap the whole program in the try...except KeyboardInterrupt block
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
27fd9cd61b
commit
e3f3c48b22
1 changed files with 21 additions and 18 deletions
39
bin/cdist
39
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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue