Fix installer interactive detection when stdin is redirected#14
Fix installer interactive detection when stdin is redirected#14cashlycash wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c532c3f530
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| prompt="${1:-Continue? [y/N]: }" | ||
| default="${2:-N}" | ||
|
|
||
| # Prefer tty when available | ||
| if is_interactive; then |
There was a problem hiding this comment.
Reinstate no-confirm short-circuit in prompt handler
The updated confirm() implementation no longer checks PEAPOD_NO_CONFIRM, so --yes/-y (which still sets that variable in main) no longer skips prompts. This is a behavioral regression for automated installs: install.sh --yes now attempts to read input instead of auto-accepting, and in non-interactive runs it can terminate early on EOF rather than proceeding. Please restore the early return when PEAPOD_NO_CONFIRM=1 before any read call.
Useful? React with 👍 / 👎.
Motivation
confirm()reliably choose between reading from/dev/ttyand stdin to match real interactive shells.Description
-t 0check withis_interactive()that attempts to open/dev/ttyvia a quiet redirection:( : < /dev/tty ) >/dev/null 2>&1.confirm()to callis_interactive()and read from/dev/ttywhen available, otherwise fall back to reading from stdin, and normalize accepted yes values (y|Y|yes|YES).main()to print whether the installer detected an interactive session.Testing
bash -n install.shto validate shell syntax, which succeeded.confirm()falls back to stdin and the newis_interactive()correctly detects when/dev/ttyis openable, which succeeded.install.shsections (is_interactive,confirm, andmain) to confirm the intended input-selection behavior.Codex Task