mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00

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>
20 lines
544 B
Python
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
|