fix(installer): read the overwrite prompt from the terminal when piped into a shell - #123
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two problems made the documented
curl ... | shcommand 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":The prompt now reads from
/dev/ttywhen stdin is not a terminal. Without a terminal and withoutSANDCAT_NON_INTERACTIVE=truethe answer stays empty and the install is still preserved, as before.2. The script did not run under dash. On Debian/Ubuntu
shis dash, which has noset -o pipefailand noERRtrap, socurl ... | shfailed immediately:Both are removed. No pipeline in the script relies on pipefail, and
set -eplus the existingEXITtrap already exit on failure and clean up.shellcheck -s shis clean apart fromlocal, which dash supports.Also:
script) pipe the installer intoshand cover answeringyand the empty-answer default. Verified on macOS (sh= bash 3.2) and Ubuntu 24.04 (sh= dash).🤖 Generated with Claude Code