[Reproducible-commits] [diffoscope] 04/23: Decode the output given by subprocess.CalledProcessError

Jérémy Bobbio lunar at moszumanska.debian.org
Sat Sep 19 23:18:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/py3
in repository diffoscope.

commit 325d264258b39d753bff0fbbb09927685251228b
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Fri Sep 18 15:47:18 2015 +0200

    Decode the output given by subprocess.CalledProcessError
    
    It's actually returning bytes. Let's hope the messages will be in UTF-8,
    but we replace decoding errors.
---
 diffoscope/comparators/binary.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diffoscope/comparators/binary.py b/diffoscope/comparators/binary.py
index 0904447..d4d7f5d 100644
--- a/diffoscope/comparators/binary.py
+++ b/diffoscope/comparators/binary.py
@@ -184,7 +184,7 @@ class File(object):
                     difference.add_comment("No differences found inside, yet data differs")
             except subprocess.CalledProcessError as e:
                 difference = self.compare_bytes(other, source=source)
-                output = re.sub(r'^', '    ', e.output, flags=re.MULTILINE)
+                output = re.sub(r'^', '    ', e.output.decode('utf-8', errors='replace'), flags=re.MULTILINE)
                 cmd = ' '.join(e.cmd)
                 difference.add_comment("Command `%s` exited with %d. Output:\n%s"
                                        % (cmd, e.returncode, output))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git



More information about the Reproducible-commits mailing list