Skip to content

Commit

Permalink
rbenv install: error out instead of prompting in non-interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed May 1, 2024
1 parent b99755b commit 81eed6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/rbenv-install
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ PREFIX="${RBENV_ROOT}/versions/${VERSION_NAME}"
if [ -d "${PREFIX}/bin" ]; then
if [ -z "$FORCE" ] && [ -z "$SKIP_EXISTING" ]; then
echo "rbenv: $PREFIX already exists" >&2
if [ ! -t 0 ]; then
echo "rbenv: must use \`--force' or \`--skip-existing' in non-interactive mode" >&2
exit 1
fi
read -rp "continue with installation? (y/N) "

case "$REPLY" in
Expand Down
5 changes: 5 additions & 0 deletions bin/rbenv-uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ if [ -z "$FORCE" ]; then
exit 1
fi

if [ ! -t 0 ]; then
echo "rbenv: must use \`--force' in non-interactive mode" >&2
exit 1
fi

read -p "rbenv: remove $PREFIX? [yN] "
case "$REPLY" in
y* | Y* ) ;;
Expand Down

0 comments on commit 81eed6c

Please sign in to comment.