fix: redirect stdin from /dev/tty for curl|sh installs
When running via `curl URL | sh`, stdin is the curl pipe, not the terminal. Interactive prompts (wizard or legacy install.sh) need a real TTY. Redirect stdin from /dev/tty when available, fall back to --non-interactive mode when no TTY exists (CI/Docker). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,15 +44,20 @@ WIZARD_BIN="$WORK_DIR/bootstrap/dist/mosaic-wizard.mjs"
|
||||
if command -v node >/dev/null 2>&1 && [ -f "$WIZARD_BIN" ]; then
|
||||
NODE_MAJOR="$(node -e 'console.log(process.versions.node.split(".")[0])')"
|
||||
if [ "$NODE_MAJOR" -ge 18 ] 2>/dev/null; then
|
||||
echo "[mosaic] Running wizard installer (Node.js $NODE_MAJOR detected)..."
|
||||
node "$WIZARD_BIN" --source-dir "$WORK_DIR/bootstrap"
|
||||
if [ -e /dev/tty ]; then
|
||||
echo "[mosaic] Running wizard installer (Node.js $NODE_MAJOR detected)..."
|
||||
node "$WIZARD_BIN" --source-dir "$WORK_DIR/bootstrap" </dev/tty
|
||||
else
|
||||
echo "[mosaic] Running wizard installer in non-interactive mode (no TTY)..."
|
||||
node "$WIZARD_BIN" --source-dir "$WORK_DIR/bootstrap" --non-interactive
|
||||
fi
|
||||
echo "[mosaic] Cleaning up temporary files..."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[mosaic] Running legacy install..."
|
||||
bash install.sh
|
||||
bash install.sh </dev/tty
|
||||
|
||||
echo "[mosaic] Cleaning up temporary files..."
|
||||
# cleanup runs via trap
|
||||
|
||||
Reference in New Issue
Block a user