From 81eed6c48ed1d6d0e83c98aba25056a95f07cda7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 1 May 2024 15:45:23 +0200 Subject: [PATCH] rbenv install: error out instead of prompting in non-interactive mode --- bin/rbenv-install | 4 ++++ bin/rbenv-uninstall | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/bin/rbenv-install b/bin/rbenv-install index 3d61f58e..f6df0f53 100755 --- a/bin/rbenv-install +++ b/bin/rbenv-install @@ -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 diff --git a/bin/rbenv-uninstall b/bin/rbenv-uninstall index 3c6eb6eb..c7696a63 100755 --- a/bin/rbenv-uninstall +++ b/bin/rbenv-uninstall @@ -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* ) ;;