From: Simon Glass <simon.glass@canonical.com> Call to_output() before raising CommandExc so that callers catching the exception get string output rather than bytes. This avoids the need for callers to handle bytes decoding themselves. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- (no changes since v1) tools/u_boot_pylib/command.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/u_boot_pylib/command.py b/tools/u_boot_pylib/command.py index cb7ebf49ce5..6b3f9fe59bf 100644 --- a/tools/u_boot_pylib/command.py +++ b/tools/u_boot_pylib/command.py @@ -136,9 +136,10 @@ def run_pipe(pipe_list, infile=None, outfile=None, capture=False, if result.stdout and oneline: result.output = result.stdout.rstrip(b'\r\n') result.return_code = last_pipe.wait() + result = result.to_output(binary) if raise_on_error and result.return_code: raise CommandExc(f"Error running '{user_pipestr}'", result) - return result.to_output(binary) + return result def output(*cmd, **kwargs): -- 2.43.0