]> code.ossystems Code Review - openembedded-core.git/commitdiff
process: handle OSErrors other than file not found
authorChris Larson <chris_larson@mentor.com>
Wed, 15 Dec 2010 22:13:07 +0000 (15:13 -0700)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 4 Jan 2011 14:46:50 +0000 (14:46 +0000)
(Bitbake rev: 7d80a5355cb540aae8d3082c1efebb72da4f93c6)

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

index f02332df9adfba566bed3269c97cb37258e2c1ec..dc97e3f72f797840b90b6a73dea9d02ba5dea734 100644 (file)
@@ -10,8 +10,9 @@ def subprocess_setup():
     signal.signal(signal.SIGPIPE, signal.SIG_DFL)
 
 class CmdError(RuntimeError):
-    def __init__(self, command):
+    def __init__(self, command, message=None):
         self.command = command
+        self.message = message
 
     def __str__(self):
         if not isinstance(self.command, basestring):
@@ -19,7 +20,10 @@ class CmdError(RuntimeError):
         else:
             cmd = self.command
 
-        return "Execution of '%s' failed" % cmd
+        msg = "Execution of '%s' failed" % cmd
+        if self.message:
+            msg += ': %s' % self.message
+        return msg
 
 class NotFoundError(CmdError):
     def __str__(self):
@@ -94,7 +98,7 @@ def run(cmd, input=None, **options):
         if exc.errno == 2:
             raise NotFoundError(cmd)
         else:
-            raise
+            raise CmdError(cmd, exc)
 
     if log:
         stdout, stderr = _logged_communicate(pipe, log, input)