Skip to content

Commit

Permalink
Disable tty pass through to talisman binary in pre-push hook mode (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
svishwanath-tw committed Sep 8, 2020
1 parent 2ef935f commit d01b683
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions global_install_scripts/talisman_hook_script.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
shopt -s extglob
exec < /dev/tty

# set TALISMAN_DEBUG="some-non-empty-value" in the env to get verbose output when the hook or talisman is running
function echo_debug() {
Expand Down Expand Up @@ -78,8 +77,12 @@ fi

DEBUG_OPTS=""
[[ $(toLower "${TALISMAN_DEBUG}") == "true" ]] && DEBUG_OPTS="-d"

INTERACTIVE=""
[[ $(toLower "${TALISMAN_INTERACTIVE}") == "true" ]] && INTERACTIVE="-i"
if [ $(toLower "${TALISMAN_INTERACTIVE}") == "true" ]; then
INTERACTIVE="-i"
[[ "${HOOKNAME}" == "pre-commit" ]] && exec < /dev/tty || echo_warning "talisman pre-push hook cannot be invoked in interactive mode currently"
fi

CMD="${TALISMAN_BINARY} ${DEBUG_OPTS} --githook ${HOOKNAME} ${INTERACTIVE}"
echo_debug "ARGS are $@"
Expand Down

0 comments on commit d01b683

Please sign in to comment.