From 6ddbe66478f64ea7f89c036df774c51ad62267f3 Mon Sep 17 00:00:00 2001 From: Maxime Petazzoni Date: Thu, 12 Apr 2012 22:06:49 +0200 Subject: [PATCH] Use check_call to correctly throw exceptions and make rendering fail Signed-off-by: Maxime Petazzoni --- scripts/render.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/scripts/render.py b/scripts/render.py index e8b5eb24..5916c43d 100755 --- a/scripts/render.py +++ b/scripts/render.py @@ -158,18 +158,13 @@ class JobRenderer(threading.Thread): montage_cmd = [ "montage", "-tile", tile, "%s.pdf[0]" % prefix, "%s.pdf[2]" % prefix, "-geometry", "+10+10", "-shadow", "%s%s" % (prefix, THUMBNAIL_SUFFIX) ] - ret = subprocess.call(montage_cmd) - if ret != 0: - return + subprocess.check_call(montage_cmd) # And now scale it to the normal thumbnail size mogrify_cmd = [ "mogrify", "-scale", "200x200", "%s%s" % (prefix, THUMBNAIL_SUFFIX) ] - ret = subprocess.call(mogrify_cmd) - if ret != 0: - return - else: - if 'png' in RENDERING_RESULT_FORMATS: + subprocess.check_call(mogrify_cmd) + elif 'png' in RENDERING_RESULT_FORMATS: img = Image.open(prefix + '.png') img.thumbnail((200, 200), Image.ANTIALIAS) img.save(prefix + THUMBNAIL_SUFFIX)