From 3f74da0e73a088f1273554f8d520e893a0697d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Sat, 4 Jan 2014 21:59:27 +0100 Subject: [PATCH] Fail hard if RBENV_NATIVE_EXT is set but extensions failed to load --- libexec/rbenv | 4 ++++ libexec/rbenv-hooks | 4 ++++ test/test_helper.bash | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/libexec/rbenv b/libexec/rbenv index a458c473..4041df82 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -18,6 +18,10 @@ if enable -f "${0%/*}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; the echo "${path%/*}" } else + if [ -n "$RBENV_NATIVE_EXT" ]; then + echo "rbenv: failed to load \`realpath' builtin" >&2 + exit 1 + fi READLINK=$(type -p greadlink readlink | head -1) if [ -z "$READLINK" ]; then echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2 diff --git a/libexec/rbenv-hooks b/libexec/rbenv-hooks index 939891d1..201c91da 100755 --- a/libexec/rbenv-hooks +++ b/libexec/rbenv-hooks @@ -20,6 +20,10 @@ if [ -z "$RBENV_COMMAND" ]; then fi if ! enable -f "${BASH_SOURCE%/*}"/rbenv-realpath.dylib realpath 2>/dev/null; then + if [ -n "$RBENV_NATIVE_EXT" ]; then + echo "rbenv: failed to load \`realpath' builtin" >&2 + exit 1 + fi READLINK=$(type -p greadlink readlink | head -1) if [ -z "$READLINK" ]; then echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2 diff --git a/test/test_helper.bash b/test/test_helper.bash index 1f772bea..461bb085 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -4,6 +4,10 @@ unset RBENV_DIR if enable -f "${BATS_TEST_DIRNAME}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then RBENV_TEST_DIR="$(realpath "$BATS_TMPDIR")/rbenv" else + if [ -n "$RBENV_NATIVE_EXT" ]; then + echo "rbenv: failed to load \`realpath' builtin" >&2 + exit 1 + fi RBENV_TEST_DIR="${BATS_TMPDIR}/rbenv" fi