From 2712ba8b585824e00af5ed523ebbf051f1a863d8 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sat, 19 Jan 2019 21:38:44 +0000 Subject: [PATCH] Log subprocess output also with non-zero exit code. --- utils/move_and_process.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/move_and_process.py b/utils/move_and_process.py index b9641148..1cfd7674 100755 --- a/utils/move_and_process.py +++ b/utils/move_and_process.py @@ -117,7 +117,11 @@ def run(cls, cmd, filepath=None, reprocess=False): else: logging.info("SKIP already existing file: %s", filepath) return - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) + try: + output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as ex: # error code <> 0 + logging.debug(ex.output.decode('utf-8')) + raise logging.debug(output.decode('utf-8'))