diff options
| -rw-r--r-- | bitbake/lib/bb/process.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bitbake/lib/bb/process.py b/bitbake/lib/bb/process.py index f02332df9a..dc97e3f72f 100644 --- a/bitbake/lib/bb/process.py +++ b/bitbake/lib/bb/process.py | |||
| @@ -10,8 +10,9 @@ def subprocess_setup(): | |||
| 10 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) | 10 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
| 11 | 11 | ||
| 12 | class CmdError(RuntimeError): | 12 | class CmdError(RuntimeError): |
| 13 | def __init__(self, command): | 13 | def __init__(self, command, message=None): |
| 14 | self.command = command | 14 | self.command = command |
| 15 | self.message = message | ||
| 15 | 16 | ||
| 16 | def __str__(self): | 17 | def __str__(self): |
| 17 | if not isinstance(self.command, basestring): | 18 | if not isinstance(self.command, basestring): |
| @@ -19,7 +20,10 @@ class CmdError(RuntimeError): | |||
| 19 | else: | 20 | else: |
| 20 | cmd = self.command | 21 | cmd = self.command |
| 21 | 22 | ||
| 22 | return "Execution of '%s' failed" % cmd | 23 | msg = "Execution of '%s' failed" % cmd |
| 24 | if self.message: | ||
| 25 | msg += ': %s' % self.message | ||
| 26 | return msg | ||
| 23 | 27 | ||
| 24 | class NotFoundError(CmdError): | 28 | class NotFoundError(CmdError): |
| 25 | def __str__(self): | 29 | def __str__(self): |
| @@ -94,7 +98,7 @@ def run(cmd, input=None, **options): | |||
| 94 | if exc.errno == 2: | 98 | if exc.errno == 2: |
| 95 | raise NotFoundError(cmd) | 99 | raise NotFoundError(cmd) |
| 96 | else: | 100 | else: |
| 97 | raise | 101 | raise CmdError(cmd, exc) |
| 98 | 102 | ||
| 99 | if log: | 103 | if log: |
| 100 | stdout, stderr = _logged_communicate(pipe, log, input) | 104 | stdout, stderr = _logged_communicate(pipe, log, input) |
