mirror of
https://github.com/collinear-ai/yc-bench.git
synced 2026-04-28 17:29:35 +00:00
When run as `curl ... | bash`, stdin is the pipe so Rich prompts abort immediately. Now detects non-tty stdin, re-downloads the script to a temp file, and exec's it — stdin becomes the terminal again. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
1.2 KiB
Bash
Executable file
28 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
# ── If stdin is not a terminal (piped via curl), re-download & re-exec ──
|
|
if [ ! -t 0 ]; then
|
|
SELF=$(mktemp /tmp/yc_bench_start.XXXXXX.sh)
|
|
curl -sSL https://raw.githubusercontent.com/collinear-ai/yc-bench/main/start.sh -o "$SELF"
|
|
exec bash "$SELF"
|
|
fi
|
|
|
|
# ── Install uv if missing ───────────────────────────────────────────────
|
|
if ! command -v uv &>/dev/null; then
|
|
echo "Installing uv..."
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
fi
|
|
|
|
# ── Clone repo (skip if already inside it) ───────────────────────────────
|
|
if [ ! -f "pyproject.toml" ] || ! grep -q "yc.bench" pyproject.toml 2>/dev/null; then
|
|
DIR=$(mktemp -d)
|
|
echo "Cloning yc-bench into $DIR/yc-bench..."
|
|
git clone --depth 1 https://github.com/collinear-ai/yc-bench.git "$DIR/yc-bench"
|
|
cd "$DIR/yc-bench"
|
|
fi
|
|
|
|
# ── Install deps & launch ───────────────────────────────────────────────
|
|
uv sync --quiet
|
|
exec uv run yc-bench start
|