u_boot_pylib: command: Convert output before raising exception
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>
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user