Skip to content

fix(installer): read the overwrite prompt from the terminal when piped into a shell - #123

Merged
adamw merged 2 commits into
masterfrom
installer-tty-prompt
Sep 17, 2026
Merged

adamw merged 2 commits into
masterfrom
installer-tty-prompt

Conversation

@adamw

@adamw adamw commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Two problems made the documented curl ... | sh command fail on an existing install, or on Debian/Ubuntu at all.

1. Re-running the installer always aborted. With curl ... | sh, stdin is the script itself, so the overwrite question got EOF and defaulted to "no":

Sandcat is already installed at ~/.local/share/sandcat/cli. Overwrite? [y/N]: [INFO] Aborted — existing install preserved.

The prompt now reads from /dev/tty when stdin is not a terminal. Without a terminal and without SANDCAT_NON_INTERACTIVE=true the answer stays empty and the install is still preserved, as before.

2. The script did not run under dash. On Debian/Ubuntu sh is dash, which has no set -o pipefail and no ERR trap, so curl ... | sh failed immediately:

sh: 13: set: Illegal option -o pipefail

Both are removed. No pipeline in the script relies on pipefail, and set -e plus the existing EXIT trap already exit on failure and clean up. shellcheck -s sh is clean apart from local, which dash supports.

Also:

  • docs: the upgrade section now mentions the prompt and how to skip it
  • tests: two pty-based tests (via script) pipe the installer into sh and cover answering y and the empty-answer default. Verified on macOS (sh = bash 3.2) and Ubuntu 24.04 (sh = dash).

🤖 Generated with Claude Code

…d into a shell

With curl ... | sh, stdin is the script itself, so the overwrite question
got EOF and always aborted. Re-running the install command now works as an
upgrade, as the docs already claimed.
set -o pipefail and the ERR trap are bash-only. Neither is needed: no
pipeline relies on pipefail, and set -e plus the EXIT trap already exit on
failure and clean up.
@adamw
adamw merged commit a85656c into master Sep 17, 2026
5 checks passed
@adamw
adamw deleted the installer-tty-prompt branch September 17, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant