diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/locale.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/locale.sh b/lib/locale.sh index 7b69873..874d376 100644 --- a/lib/locale.sh +++ b/lib/locale.sh @@ -43,12 +43,12 @@ _ob_try_load_messages() ms="$(printf "${_OB_LOCALE_PATH}" \ "${locale}" "${_ob_text_domain}")" - if [ -f "${ms}" ]; then - . "${ms}" - else - return 1 - fi - + # POSIX on the dot utility: + # "If no readable file is found, a non-interactive shell shall abort" + # So to survive an ENOENT or other error and display a more informative + # error message before aborting, we need this eval/cat command. This is + # more resilient against race conditions than `[ -f "${ms}" ]` is. + eval "$(cat "${ms}" 2>/dev/null)" || return 1 return 0 } |