Skip to content

Commit 981feaf

Browse files
committed
Silence ImageMagick
1 parent 529ca51 commit 981feaf

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

webdiff/util.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,17 @@ def generate_pdiff_image(before_path, after_path):
286286
# 0 on success & similar images
287287
# 1 on success & dissimilar images
288288
# 2 on failure
289-
result = subprocess.call([
290-
'compare',
291-
'-metric', 'RMSE',
292-
'-highlight-color', 'Red',
293-
'-compose', 'Src',
294-
before_path, after_path, diff_path
295-
])
289+
PIPE = subprocess.PIPE
290+
p = subprocess.Popen([
291+
'compare',
292+
'-metric', 'RMSE',
293+
'-highlight-color', 'Red',
294+
'-compose', 'Src',
295+
before_path, after_path, diff_path
296+
], stdin=PIPE, stdout=PIPE, stderr=PIPE)
297+
output, err = p.communicate() # `compare` is noisy; this swallows its output
298+
result = p.returncode
299+
296300
if result == 2:
297301
raise ImageMagickError('compare failed. Perhaps image dimensions differ.')
298302
if result == 0:

0 commit comments

Comments
 (0)