mirror of
https://github.com/collinear-ai/yc-bench.git
synced 2026-04-19 12:58:03 +00:00
Fix start.sh: re-download and re-exec when piped via curl
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>
This commit is contained in:
parent
040e678a76
commit
d4ce0a1e5a
1 changed files with 12 additions and 7 deletions
19
start.sh
19
start.sh
|
|
@ -1,6 +1,13 @@
|
|||
#!/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..."
|
||||
|
|
@ -10,14 +17,12 @@ fi
|
|||
|
||||
# ── Clone repo (skip if already inside it) ───────────────────────────────
|
||||
if [ ! -f "pyproject.toml" ] || ! grep -q "yc.bench" pyproject.toml 2>/dev/null; then
|
||||
TMPDIR=$(mktemp -d)
|
||||
echo "Cloning yc-bench into $TMPDIR/yc-bench..."
|
||||
git clone --depth 1 https://github.com/collinear-ai/yc-bench.git "$TMPDIR/yc-bench"
|
||||
cd "$TMPDIR/yc-bench"
|
||||
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 ───────────────────────────────────────────────
|
||||
# When piped via curl, stdin is the pipe — reattach to the terminal
|
||||
# so interactive prompts work.
|
||||
uv sync --quiet
|
||||
exec uv run yc-bench start </dev/tty
|
||||
exec uv run yc-bench start
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue