claude: say on stderr when the hive's pinned claude-code is missing
A set HYPERHIVE_CLAUDE_CODE_PATH whose build is gone (collected after a bump while the container still holds the old facts) made the wrapper run the container's own claude-code silently, which can be a different version. It now prints one line naming the missing path. Refs #4857
This commit is contained in:
parent
9113651c10
commit
9b1fe85706
3 changed files with 17 additions and 7 deletions
|
|
@ -112,18 +112,22 @@ chmod +x "$dir/own/bin/claude" "$dir/pinned/bin/claude"
|
|||
printf '%s' "$CLAUDE_WRAPPER" | sed -E "s|/nix/store/[^ ]+/bin/claude|$dir/own/bin/claude|" >"$dir/claude"
|
||||
case="claude setup"
|
||||
if ! grep -qF "$dir/own/bin/claude" "$dir/claude"; then fail "the rewrite did not reach the fallback claude"; fi
|
||||
# claude_check <description> <pin or ""> <which ran> <expected stderr>
|
||||
claude_check() {
|
||||
case=$1
|
||||
count=$((count + 1))
|
||||
local got pin=()
|
||||
local got said pin=()
|
||||
if [ -n "$2" ]; then pin=("HYPERHIVE_CLAUDE_CODE_PATH=$2"); fi
|
||||
# Under this shell: the shebang names the build's bash, not in this sandbox.
|
||||
got=$(env -i "${pin[@]}" "$BASH" "$dir/claude" -p hi)
|
||||
got=$(env -i "${pin[@]}" "$BASH" "$dir/claude" -p hi 2>"$dir/stderr")
|
||||
said=$(cat "$dir/stderr")
|
||||
if [ "$got" != "$3 -p hi" ]; then fail "ran: $got, wanted: $3 -p hi"; fi
|
||||
if [ "$said" != "$4" ]; then fail "said on stderr: '$said', wanted: '$4'"; fi
|
||||
}
|
||||
claude_check "the pinned claude when the hive hands one over" "$dir/pinned" pinned
|
||||
claude_check "the container's own claude with no pin" "" own
|
||||
claude_check "the container's own claude when the pinned path is gone" "$dir/gone" own
|
||||
claude_check "the pinned claude when the hive hands one over, silently" "$dir/pinned" pinned ""
|
||||
claude_check "the container's own claude with no pin, silently" "" own ""
|
||||
claude_check "the container's own claude when the pinned path is gone, saying so" "$dir/gone" own \
|
||||
"claude: $dir/gone/bin/claude, the hive's pinned claude-code, is missing; running this container's own"
|
||||
|
||||
echo "$count cases, $failures failed"
|
||||
[ "$failures" -eq 0 ]
|
||||
|
|
|
|||
Loading…
Reference in a new issue