poky/meta/lib/oeqa/utils/subprocesstweak.py
Ross Burton d67bfdfa1a lib/oeqa/subprocesstweak: clean up __str__()
Call super().__str__ to get the bulk of the string representation, and
we don't need to guard on output/strerr existing as they always set.

(From OE-Core rev: 2adcac16dd26fd054ea779cc4e7aa32282d9bdde)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-06-05 11:02:22 +01:00

20 lines
544 B
Python

#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#
import subprocess
class OETestCalledProcessError(subprocess.CalledProcessError):
def __str__(self):
def strify(o):
return o.decode("utf-8", errors="replace") if isinstance(o, bytes) else o
s = super().__str__()
s = s + "\nStandard Output: " + strify(self.output)
s = s + "\nStandard Error: " + strify(self.stderr)
return s
def errors_have_output():
subprocess.CalledProcessError = OETestCalledProcessError