From ef835bf33a9c5bddb5b3c7951178f86ed29a37f4 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 10 Jun 2010 10:21:41 -0700 Subject: [PATCH] Handle SystemExit and KeyboardInterrupt sanely when executing a command (Bitbake rev: 17f40d036814e4abf6d87363fff7823c8c85c298) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/command.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index a590e61abe..32d5b5bab6 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py @@ -89,7 +89,16 @@ class Command: return False else: return False - except: + except KeyboardInterrupt as exc: + self.finishAsyncCommand("Interrupted") + return False + except SystemExit as exc: + arg = exc.args[0] + if isinstance(arg, basestring): + self.finishAsyncCommand(arg) + else: + self.finishAsyncCommand("Exited with %s" % arg) + except Exception: import traceback self.finishAsyncCommand(traceback.format_exc()) return False