From 61270c827788c68f22b26f437e0adafcbe4b2c3d Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Wed, 5 Jul 2017 08:11:50 -0500 Subject: [PATCH] Prevent command from running if "pre" hook fails --- yadm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/yadm b/yadm index a547142..93252fb 100755 --- a/yadm +++ b/yadm @@ -892,6 +892,15 @@ function invoke_hook() { export YADM_HOOK_WORK "$hook_command" + hook_status=$? + + #; failing "pre" hooks will prevent commands from being run + if [ "$mode" = "pre" ] && [ "$hook_status" -ne 0 ]; then + echo "Hook $hook_command was not successful" + echo "$HOOK_COMMAND will not be run" + exit "$hook_status" + fi + fi }