mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
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>
This commit is contained in:
parent
3b1c0b09c9
commit
6eace39807
1 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue