Return the output from failed commands in CalledProcessError
Some callers expect CalledProcessError.output to have the output, so
pass up the stdout + stderr output.
This means failed runcmd template commands will log to program.log and
lorax.log
(cherry picked from commit 522ec34360
)
This commit is contained in:
parent
4ffcd47874
commit
0c2905d2a3
@ -195,7 +195,8 @@ def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None, log_ou
|
|||||||
program_log.debug("Return code: %d", proc.returncode)
|
program_log.debug("Return code: %d", proc.returncode)
|
||||||
|
|
||||||
if proc.returncode and raise_err:
|
if proc.returncode and raise_err:
|
||||||
raise subprocess.CalledProcessError(proc.returncode, argv)
|
output = output_string or "" + err_string or ""
|
||||||
|
raise subprocess.CalledProcessError(proc.returncode, argv, output)
|
||||||
|
|
||||||
return (proc.returncode, output_string)
|
return (proc.returncode, output_string)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user