Skip to content

Fix installer interactive detection when stdin is redirected#14

Open
cashlycash wants to merge 2 commits intomainfrom
codex/replace-read-command-in-installer-sejmji
Open

Fix installer interactive detection when stdin is redirected#14
cashlycash wants to merge 2 commits intomainfrom
codex/replace-read-command-in-installer-sejmji

Conversation

@cashlycash
Copy link
Copy Markdown
Collaborator

Motivation

  • Avoid false non-interactive detection when stdin is piped or redirected so prompts still use the controlling terminal when available.
  • Make confirm() reliably choose between reading from /dev/tty and stdin to match real interactive shells.

Description

  • Replaced the -t 0 check with is_interactive() that attempts to open /dev/tty via a quiet redirection: ( : < /dev/tty ) >/dev/null 2>&1.
  • Updated confirm() to call is_interactive() and read from /dev/tty when available, otherwise fall back to reading from stdin, and normalize accepted yes values (y|Y|yes|YES).
  • Added simple runtime diagnostic output in main() to print whether the installer detected an interactive session.

Testing

  • Ran bash -n install.sh to validate shell syntax, which succeeded.
  • Executed a piped-input shell snippet that simulates redirected stdin to verify confirm() falls back to stdin and the new is_interactive() correctly detects when /dev/tty is openable, which succeeded.
  • Manually inspected the modified install.sh sections (is_interactive, confirm, and main) to confirm the intended input-selection behavior.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread install.sh
Comment on lines +176 to +180
prompt="${1:-Continue? [y/N]: }"
default="${2:-N}"

# Prefer tty when available
if is_interactive; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant