nandi/frqpublic Fork 0
57c6de2
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Ask the bb on PATH who it is before handing it a script

`scripts/bb` takes any `bb` it finds as babashka, and bazel's launcher
calls itself that too. On a host with one of those ahead of the shell's,
every recipe here answered with

    Command 'scripts/tui.bb' not found. Try 'bb help'

which reads as a missing script rather than as the wrong program — and it
is every recipe, since they all start here.

The version line is the cheapest question babashka answers and the one
nothing else answers the same way. An impostor now falls through to the
flake, or to the container, which is where the script wanted to be.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-03T01:12:15-07:00 Browse files
57c6de2 parent: 1e8b590
modified scripts/bb +10 -2
@@ -16,7 +16,12 @@
1616 # Three answers, in order:
1717 #
1818 # bb on PATH the dev shell puts one there, and so does a machine that
19-# has its own; either is what the caller meant
19+# has its own; either is what the caller meant — as long as
20+# it is babashka. `bb` is also what bazel's own launcher
21+# calls itself, and a host with one of those ahead of the
22+# shell's answered every recipe here with "Command
23+# 'scripts/tui.bb' not found. Try 'bb help'", which reads as
24+# a missing script rather than the wrong program
2025 # the flake built once and kept alive by the symlink under build/,
2126 # which is a gc root as well as a cache
2227 # the container nix is not on every host this runs on — see CLAUDE.md —
@@ -26,7 +31,10 @@ set -e
2631
2732 root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
2833
29-if command -v bb >/dev/null 2>&1; then
34+# Asking it who it is, rather than trusting the name: the version line is the
35+# cheapest question babashka answers and the one nothing else answers the same
36+# way.
37+if command -v bb >/dev/null 2>&1 && bb --version 2>/dev/null | grep -qi '^babashka'; then
3038 exec bb "$@"
3139 fi
3240
@@ -16,7 +16,12 @@
16 # Three answers, in order:16 # Three answers, in order:
17 #17 #
18 # bb on PATH the dev shell puts one there, and so does a machine that18 # bb on PATH the dev shell puts one there, and so does a machine that
19-# has its own; either is what the caller meant19+# has its own; either is what the caller meant — as long as
20+# it is babashka. `bb` is also what bazel's own launcher
21+# calls itself, and a host with one of those ahead of the
22+# shell's answered every recipe here with "Command
23+# 'scripts/tui.bb' not found. Try 'bb help'", which reads as
24+# a missing script rather than the wrong program
20 # the flake built once and kept alive by the symlink under build/,25 # the flake built once and kept alive by the symlink under build/,
21 # which is a gc root as well as a cache26 # which is a gc root as well as a cache
22 # the container nix is not on every host this runs on — see CLAUDE.md —27 # the container nix is not on every host this runs on — see CLAUDE.md —
@@ -26,7 +31,10 @@ set -e
26 31
27 root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)32 root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
28 33
29-if command -v bb >/dev/null 2>&1; then34+# Asking it who it is, rather than trusting the name: the version line is the
35+# cheapest question babashka answers and the one nothing else answers the same
36+# way.
37+if command -v bb >/dev/null 2>&1 && bb --version 2>/dev/null | grep -qi '^babashka'; then
30 exec bb "$@"38 exec bb "$@"
31 fi39 fi
32 40