fix: use /dev/tty directly for interactive docs/ prompt

- remove /dev/tty stdin redirect from exec (unreliable on macOS)
- check [[ -e /dev/tty ]] instead of [[ -t 0 ]] — works through curl | bash
- read answer directly from /dev/tty, bypassing piped stdin
This commit is contained in:
moilanik 2026-03-03 11:32:28 +02:00
parent 8d3758cd6c
commit 6c0a40f186

View File

@ -18,8 +18,7 @@ if [[ -z "${BASH_SOURCE[0]:-}" ]]; then
git clone "$REPO_URL" "$TARGET" || { echo "✗ git clone failed"; exit 1; }
fi
# Pass DEV_ROOT explicitly — local mode must not guess it from script location
# Reopen stdin from /dev/tty so local mode can prompt interactively
exec bash "$TARGET/apply.sh" --bootstrapped "$DEV_ROOT" </dev/tty
exec bash "$TARGET/apply.sh" --bootstrapped "$DEV_ROOT"
fi
# ── Guard — block direct invocation ──────────────────────────────────────────
@ -78,9 +77,9 @@ setup_project() {
# FR-5 + FR-6: docs
local docs="$project/docs"
if [[ ! -d "$docs" ]]; then
if [[ -t 0 ]]; then
if [[ -t 0 ]] || [[ -e /dev/tty ]]; then
printf " ? no docs/ folder — create it? [y/N] "
read -r answer
read -r answer </dev/tty
if [[ "${answer,,}" == "y" ]]; then
mkdir -p "$docs"
echo " ✓ created docs/"