fix(rtk): follow up the #284 review notes #287

Merged
Defame1297 merged 3 commits from fix/rtk-review-polish into main 2026-12-06 16:47:29 +00:00
Showing only changes of commit 98e8c27cdf - Show all commits
+6 -1
View File
@@ -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"