Commit 8688d98c authored by Vincent Pelletier's avatar Vincent Pelletier

Hide traceback caused by KeyboardInterrupt.

Use a decorator to not indent the whole function.
parent 2091fbda
...@@ -1212,6 +1212,16 @@ def getTZInfo(tz): ...@@ -1212,6 +1212,16 @@ def getTZInfo(tz):
_tz_cache[tz] = tzi = AutoTZInfo(tz) _tz_cache[tz] = tzi = AutoTZInfo(tz)
return tzi return tzi
def _gracefulExit(*class_list):
@functools.wraps(func)
def wrapper(*args, **kw):
try:
return func(*args, **kw)
except KeyboardInterrupt:
sys.exit(1)
return wrapper
@_gracefulExit
def main(): def main():
parser = ShlexArgumentParser(description='Compute Apdex out of ' parser = ShlexArgumentParser(description='Compute Apdex out of '
'apache-style log files', fromfile_prefix_chars='@') 'apache-style log files', fromfile_prefix_chars='@')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment