diff --git a/perguntations/tools.py b/perguntations/tools.py index f7e114c..e75663c 100644 --- a/perguntations/tools.py +++ b/perguntations/tools.py @@ -67,21 +67,16 @@ def run_script(script: str, stderr=subprocess.STDOUT, universal_newlines=True, timeout=timeout, - check=False, + check=True, ) - except OSError: - logger.error('Can not execute script "%s".', script) - return output except subprocess.TimeoutExpired: logger.error('Timeout %ds exceeded running "%s".', timeout, script) return output - except Exception: - logger.error('An Exception ocurred running "%s".', script) + except subprocess.CalledProcessError as exc: + logger.error('Return code %d running "%s".', exc.returncode, script) return output - - # --- check return code - if proc.returncode != 0: - logger.error('Return code %d running "%s".', proc.returncode, script) + except OSError: + logger.error('Can not execute script "%s".', script) return output # --- parse yaml -- libgit2 0.21.2