Prevent command from running if "pre" hook fails

This commit is contained in:
Tim Byrne 2017-07-05 08:11:50 -05:00
parent f73c873681
commit 61270c8277
No known key found for this signature in database
GPG Key ID: 14DB4FC2465A4B12
1 changed files with 9 additions and 0 deletions

9
yadm
View File

@ -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
}