display error when hook fails

This commit is contained in:
HgO
2020-12-25 23:06:54 +01:00
parent f2eaece8cb
commit 3d975b1f17
2 changed files with 8 additions and 2 deletions

View File

@@ -308,7 +308,11 @@ class Domain(PrivateKey):
def run_hooks(self) -> None:
for hook in self.hooks:
logging.info(f"Running hook: '{hook}'")
subprocess.run(hook.split())
hook_res = subprocess.run(hook.split(),
stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE)
if hook_res.returncode != 0:
logging.error(f"Unable to run hook: {hook_res.stderr}")
def main():