1
0
mirror of https://github.com/samba-team/samba.git synced 2025-05-28 21:05:48 +03:00

python:tests: Decode stdout and stderr for greater readability

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15852

Signed-off-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Jennifer Sutton 2024-08-06 13:51:00 +12:00 committed by Jo Sutton
parent 5e0b53542b
commit b7e7a07050

View File

@ -494,9 +494,17 @@ class BlackboxProcessError(Exception):
self.msg = msg
def __str__(self):
stdout = self.stdout
if isinstance(stdout, bytes):
stdout = stdout.decode()
stderr = self.stderr
if isinstance(stderr, bytes):
stderr = stderr.decode()
s = ("Command '%s'; shell %s; exit status %d; "
"stdout: '%s'; stderr: '%s'" %
(self.cmd, self.shell, self.returncode, self.stdout, self.stderr))
(self.cmd, self.shell, self.returncode, stdout, stderr))
if self.msg is not None:
s = "%s; message: %s" % (s, self.msg)