diff options
author | Ross Burton <ross.burton@arm.com> | 2025-06-04 15:03:24 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-06-05 11:02:22 +0100 |
commit | d67bfdfa1ab7181043f6b7b9e1f79ea0ca3a42b6 (patch) | |
tree | 56ca595c4f2ef65b2d435c3df044e603d81ca9b0 | |
parent | 97a4062189076c827fa8cb283838c8f9ff280de2 (diff) | |
download | poky-d67bfdfa1ab7181043f6b7b9e1f79ea0ca3a42b6.tar.gz |
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>
-rw-r--r-- | meta/lib/oeqa/utils/subprocesstweak.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/meta/lib/oeqa/utils/subprocesstweak.py b/meta/lib/oeqa/utils/subprocesstweak.py index 3e43ed547b..1774513023 100644 --- a/meta/lib/oeqa/utils/subprocesstweak.py +++ b/meta/lib/oeqa/utils/subprocesstweak.py | |||
@@ -8,16 +8,11 @@ import subprocess | |||
8 | class OETestCalledProcessError(subprocess.CalledProcessError): | 8 | class OETestCalledProcessError(subprocess.CalledProcessError): |
9 | def __str__(self): | 9 | def __str__(self): |
10 | def strify(o): | 10 | def strify(o): |
11 | if isinstance(o, bytes): | 11 | return o.decode("utf-8", errors="replace") if isinstance(o, bytes) else o |
12 | return o.decode("utf-8", errors="replace") | ||
13 | else: | ||
14 | return o | ||
15 | 12 | ||
16 | s = "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) | 13 | s = super().__str__() |
17 | if hasattr(self, "output") and self.output: | 14 | s = s + "\nStandard Output: " + strify(self.output) |
18 | s = s + "\nStandard Output: " + strify(self.output) | 15 | s = s + "\nStandard Error: " + strify(self.stderr) |
19 | if hasattr(self, "stderr") and self.stderr: | ||
20 | s = s + "\nStandard Error: " + strify(self.stderr) | ||
21 | return s | 16 | return s |
22 | 17 | ||
23 | def errors_have_output(): | 18 | def errors_have_output(): |