patman: Allow running a tool and returning the full result
authorSimon Glass <sjg@chromium.org>
Mon, 10 Jan 2022 03:13:40 +0000 (20:13 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 25 Jan 2022 19:36:10 +0000 (12:36 -0700)
commitade5327655802b0149a4a569dd489318ad59adc3
tree2a0b7371997c15d63c6f9d9db57f7c3deaa81d02
parent8bc78b73fb873590238a1788db8783ab8f65e5a1
patman: Allow running a tool and returning the full result

Add a new function which returns the entire result from running a tool,
not just stdout. Update Run() to use this and to return stdout on error,
if stderr is empty, since some unfortunate tools write their error
output to stdout rather than stderr.

Move building of the PATH to a separate function.

Make the exception catching more specific, to catch just ValueError, since
broad exceptions are a pain to debug.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/patman/tools.py