From 9b0c9a49e853c063eb7c6443abdd424c57fd7fb1 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sat, 13 May 2017 20:28:11 +0200 Subject: [PATCH] [core] Cleanly abort on ctrl+c During debugging, being able to cleanly (i.e. without backtrace) exit using ctrl+c is a very welcome functionality :) --- bumblebee-status | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/bumblebee-status b/bumblebee-status index ef669e2..582f314 100755 --- a/bumblebee-status +++ b/bumblebee-status @@ -38,6 +38,9 @@ def main(): inp=inp, ) engine.run() + except KeyboardInterrupt as error: + inp.stop() + sys.exit(0) except BaseException as e: logging.exception(e) if output.started(): @@ -56,18 +59,6 @@ def main(): output.flush() output.end() time.sleep(1) -# try: -# except KeyboardInterrupt as error: -# inp.stop() -# sys.exit(0) -# except bumblebee.error.BaseError as error: -# inp.stop() -# sys.stderr.write("fatal: {}\n".format(error)) -# sys.exit(1) -# except Exception as error: -# inp.stop() -# sys.stderr.write("fatal: {}\n".format(error)) -# sys.exit(2) if __name__ == "__main__": main()