- res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True,
- env={'LC_ALL': 'C.UTF-8'}, timeout=600)
- logging.debug("unpacking exited with %d status code. STDOUT/STDERR: %s" % (res.returncode, res.stdout))
+ try:
+ res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True,
+ env={'LC_ALL': 'C.UTF-8'}, timeout=600)
+ except subprocess.CalledProcessError as err:
+ logging.error("unpacking exited with status code %d." % err.returncode)
+ logging.error("STDOUT:")
+ if err.stdout:
+ for line in err.stdout.decode('utf-8').split("\n"):
+ logging.error(line)
+ logging.error("STDERR:")
+ if err.stderr:
+ for line in err.stderr.decode('utf-8').split("\n"):
+ logging.error(line)
+ raise
+ else:
+ logging.debug("unpacking exited with status code %d." % res.returncode)
+ logging.debug("STDOUT/STDERR:")
+ if res.stdout:
+ for line in res.stdout.decode('utf-8').split("\n"):
+ logging.debug(line)
+