]> code.ossystems Code Review - openembedded-core.git/commitdiff
Handle SystemExit and KeyboardInterrupt sanely when executing a command
authorChris Larson <chris_larson@mentor.com>
Thu, 10 Jun 2010 17:21:41 +0000 (10:21 -0700)
committerRichard Purdie <rpurdie@linux.intel.com>
Fri, 2 Jul 2010 14:41:36 +0000 (15:41 +0100)
(Bitbake rev: 17f40d036814e4abf6d87363fff7823c8c85c298)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/lib/bb/command.py

index a590e61abe5c89ba513490554251b9911a7a2877..32d5b5bab6fe7ba2f0cafcdc66cf1efd94d8024f 100644 (file)
@@ -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