Skip to content

Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy

Rust

improve debug proxy startup checks

Raine Virta6df145d2727a
diff --git a/scripts/debug-proxy b/scripts/debug-proxy
index fe5337e..d229d00 100755
--- a/scripts/debug-proxy
+++ b/scripts/debug-proxy
@@ -41,7 +41,17 @@ if (($# == 1)); then
exit 0
fi
-repo_root="$(git rev-parse --show-toplevel)"
+for command in git cargo curl; do
+ if ! command -v "$command" >/dev/null 2>&1; then
+ printf 'error: required command not found: %s\n' "$command" >&2
+ exit 1
+ fi
+done
+
+if ! repo_root="$(git rev-parse --show-toplevel 2>/dev/null)"; then
+ printf 'error: run this helper from a claude-code-proxy checkout\n' >&2
+ exit 1
+fi
run_dir="$(mktemp -d "${TMPDIR:-/tmp}/claude-code-proxy-debug.XXXXXX")"
state_home="$run_dir/state"
server_log="$run_dir/server.log"
@@ -84,7 +94,10 @@ for _attempt in {1..20}; do
fi
if curl --fail --silent \
"http://127.0.0.1:$proxy_port/healthz" >/dev/null 2>&1; then
- break 2
+ sleep 0.1
+ if kill -0 "$proxy_pid" 2>/dev/null; then
+ break 2
+ fi
fi
sleep 0.1
done