diff --git a/libexec/pyenv-rehash b/libexec/pyenv-rehash index 5c421c41..4e31994e 100755 --- a/libexec/pyenv-rehash +++ b/libexec/pyenv-rehash @@ -40,13 +40,14 @@ if [ ! -w "$SHIM_PATH" ]; then fi unset acquired -for (( i=1; i<="${PYENV_REHASH_TIMEOUT:-60}"; i++ )); do +start=$SECONDS +while (( SECONDS <= start + ${PYENV_REHASH_TIMEOUT:-60} )); do if acquire_lock 2>/dev/null; then acquired=1 break else - # POSIX sleep(1) doesn't provides time precision of subsecond - sleep 1 + # POSIX sleep(1) doesn't provide subsecond precision, but many others do + sleep 0.1 2>/dev/null || sleep 1 fi done