diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-12-15 15:13:07 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:50 +0000 |
commit | ddf2c687d8620494f6e994d2d2b1835d605b6258 (patch) | |
tree | a9236631c0d240d8e658675156e6671133c5c396 /bitbake/lib/bb/process.py | |
parent | 3d51fd2b7d5a0838053db1df3f1e0234ee306411 (diff) | |
download | poky-ddf2c687d8620494f6e994d2d2b1835d605b6258.tar.gz |
process: handle OSErrors other than file not found
(Bitbake rev: 7d80a5355cb540aae8d3082c1efebb72da4f93c6)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/process.py')
-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) |