summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/subprocesstweak.py
blob: 1774513023b313b8ecde61623ecc8a31408ae5d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# 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