From 1c3c8dfcb29be2111fb8b500ce6ae71c3351599a Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 12 May 2016 02:35:43 +0200 Subject: [PATCH] [enh] fail if a command fail --- prosopopee/prosopopee.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index 15ead24..451396d 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -74,15 +74,14 @@ class Video(object): if options.get("resize"): command = "{binary} {loglevel} -i {source} {resize} -vframes 1 -y {target}".format(**ffmpeg_switches) - print(command) - os.system(command) + error(os.system(command) == 0, "gm command failed") else: command = "{binary} {loglevel} -i {source} {resolution} {preselect} {bitrate} -pass 1 -an {format} -y {target}".format(**ffmpeg_switches) command2 = "{binary} {loglevel} -i {source} {resolution} {preselect} {bitrate} -pass 2 -acodec libvorbis -ab 100k {format} -y {target}".format(**ffmpeg_switches) print(command) - os.system(command) + error(os.system(command) == 0, "gm command failed") print(command2) - os.system(command2) + error(os.system(command2) == 0, "gm command failed") CACHE.cache_picture(source, target, options) @@ -142,7 +141,7 @@ class Image(object): warning("Generation", source) print(command) - os.system(command) + error(os.system(command) == 0, "gm command failed") CACHE.cache_picture(source, target, options)