From 65ab80df80333acedf7f8c7dfc16b3da0daa6bd9 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Mon, 29 Jan 2018 05:19:47 -0500 Subject: Catch exceptions from subprocess in build_docs [ci skip] If eg binary file not found, this just crashed with no useful diagnostic. --- src/scripts/build_docs.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/scripts') diff --git a/src/scripts/build_docs.py b/src/scripts/build_docs.py index da36b5348..df99ba9c3 100755 --- a/src/scripts/build_docs.py +++ b/src/scripts/build_docs.py @@ -54,13 +54,19 @@ def run_and_check(cmd_line, cwd=None): logging.debug("Executing %s", ' '.join(cmd_line)) - proc = subprocess.Popen(cmd_line, - close_fds=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - cwd=cwd) + stdout = None + stderr = None - (stdout, stderr) = proc.communicate() + try: + proc = subprocess.Popen(cmd_line, + close_fds=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + cwd=cwd) + + (stdout, stderr) = proc.communicate() + except OSError as e: + logging.error("Executing %s failed (%s)", ' '.join(cmd_line), e) if stdout: logging.debug(stdout.decode()) -- cgit v1.2.3