]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python:tests: Decode stdout and stderr for greater readability
authorJennifer Sutton <jennifersutton@catalyst.net.nz>
Tue, 6 Aug 2024 01:51:00 +0000 (13:51 +1200)
committerJo Sutton <jsutton@samba.org>
Mon, 26 May 2025 02:41:36 +0000 (02:41 +0000)
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>
python/samba/tests/__init__.py

index a5b6cb658eb8ec891deda898b1596d2d84ea0326..dc3c4ab55ae958108a38aec1aa664c092dad128c 100644 (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)