Decode error messages from image converters. #7670

Merged
merged 2 commits into from Dec 24, 2016
@@ -113,8 +113,8 @@ def get_file_hash(path, block_size=2 ** 20):
def make_external_conversion_command(cmd):
def convert(old, new):
cmdline = cmd(old, new)
- pipe = subprocess.Popen(
- cmdline, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ pipe = subprocess.Popen(cmdline, universal_newlines=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = pipe.communicate()
errcode = pipe.wait()
if not os.path.exists(new) or errcode:
@@ -224,8 +224,8 @@ def verify(filename):
verifier = verifiers.get(extension, None)
if verifier is not None:
cmd = verifier(filename)
- pipe = subprocess.Popen(
- cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ pipe = subprocess.Popen(cmd, universal_newlines=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = pipe.communicate()
errcode = pipe.wait()
if errcode != 0: