summaryrefslogtreecommitdiffstats
path: root/tools/patman
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-08-24 07:22:42 -0600
committerSimon Glass <sjg@chromium.org>2019-10-15 08:40:02 -0600
commit6eace398072a62e74f10f412ffadfe51b7402395 (patch)
tree2e1531dfcf318de3d3a80acafb529b045d463649 /tools/patman
parent3b1c0b09c99bfd30355a6ba87a15e9d408a51109 (diff)
downloadu-boot-6eace398072a62e74f10f412ffadfe51b7402395.tar.gz
u-boot-6eace398072a62e74f10f412ffadfe51b7402395.tar.xz
u-boot-6eace398072a62e74f10f412ffadfe51b7402395.zip
patman: Update command.Run() to handle failure better
At present tools are not expected to fail. If they do an exception is raised but there is no detail about what went wrong. This makes it hard to debug if something does actually go wrong. Fix this by outputting both stderr and stdout on failure. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman')
-rw-r--r--tools/patman/tools.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 97441ca796..0952681579 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -205,8 +205,14 @@ def Run(name, *args):
if tool_search_paths:
env = dict(os.environ)
env['PATH'] = ':'.join(tool_search_paths) + ':' + env['PATH']
- return command.Run(name, *args, capture=True, capture_stderr=True,
- env=env)
+ all_args = (name,) + args
+ result = command.RunPipe([all_args], capture=True, capture_stderr=True,
+ env=env, raise_on_error=False)
+ if result.return_code:
+ raise Exception("Error %d running '%s': %s" %
+ (result.return_code,' '.join(all_args),
+ result.stderr))
+ return result.stdout
except:
if env and not PathHasFile(env['PATH'], name):
msg = "Please install tool '%s'" % name