rbenv install: error out instead of prompting in non-interactive mode

This commit is contained in:
Mislav Marohnić 2024-05-01 15:45:23 +02:00
parent b99755bf05
commit 81eed6c48e
No known key found for this signature in database
2 changed files with 9 additions and 0 deletions

View file

@ -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

View file

@ -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* ) ;;