summaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/run-hook.cmd17
1 files changed, 16 insertions, 1 deletions
diff --git a/hooks/run-hook.cmd b/hooks/run-hook.cmd
index a2f7c48..928aaba 100755
--- a/hooks/run-hook.cmd
+++ b/hooks/run-hook.cmd
@@ -59,4 +59,19 @@ case "$0" in
esac
SCRIPT_NAME="$1"
shift
-exec "${BASH:-bash}" "${SCRIPT_DIR}/${SCRIPT_NAME}" "$@"
+
+# Without bash installed, the harness runs this file with zsh or sh and $BASH
+# is unset (#2503). session-start runs unchanged under zsh, so fall back to
+# it, and otherwise exit quietly like the Windows half: the plugin still
+# works, just without SessionStart context injection.
+if [ -n "${BASH:-}" ]; then
+ shell="$BASH"
+elif command -v bash >/dev/null 2>&1; then
+ shell="bash"
+elif command -v zsh >/dev/null 2>&1; then
+ shell="zsh"
+else
+ exit 0
+fi
+
+exec "$shell" "${SCRIPT_DIR}/${SCRIPT_NAME}" "$@"