fix(rtk): follow up the #284 review notes #287
@@ -18,7 +18,8 @@ fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
|
||||
|
||||
[[ -f "$SRC" ]] || { echo "FAIL: $SRC does not exist"; exit 1; }
|
||||
REAL_RTK="$(command -v rtk || true)"
|
||||
TIMEOUT="$(command -v timeout)"
|
||||
TIMEOUT="$(command -v timeout || true)"
|
||||
[[ -n "$TIMEOUT" ]] || { echo "FAIL: timeout(1) is not on PATH; install coreutils to run these tests"; exit 1; }
|
||||
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
@@ -105,6 +106,10 @@ else
|
||||
# so rtk passes it through with no output. A later rtk may add one.
|
||||
run "$HOOK" "$REAL_PATH" "echo hello"
|
||||
if [[ $RC -eq 0 && -z "$OUT" ]]; then pass; else fail "echo hello: want no output, got $RC: $OUT"; fi
|
||||
# Backs the README's "running both hooks is harmless": rtk leaves a command
|
||||
# that already starts with rtk alone, so a second hook adds nothing.
|
||||
run "$HOOK" "$REAL_PATH" "rtk git status"
|
||||
if [[ $RC -eq 0 && -z "$OUT" ]]; then pass; else fail "rtk git status: want no output, got $RC: $OUT"; fi
|
||||
fi
|
||||
|
||||
echo "== hooks.json"
|
||||
|
||||
Reference in new issue
Block a user