From ee881e3f968d0699b136ea0b274919033b490017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ga=C5=88o?= Date: Fri, 26 Nov 2021 15:16:47 +0100 Subject: [PATCH] Avoid exception messages while autocomplete initialization in export.sh --- export.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/export.sh b/export.sh index c09f8592bd..c10ee3f56f 100644 --- a/export.sh +++ b/export.sh @@ -147,6 +147,7 @@ __cleanup() { unset ESP_PYTHON unset SOURCE_ZSH unset SOURCE_BASH + unset WARNING_MSG unset __realpath unset __main @@ -177,7 +178,9 @@ __enable_autocomplete() { eval "$(env _IDF.PY_COMPLETE=$SOURCE_ZSH idf.py)" || echo "WARNING: Failed to load shell autocompletion for zsh version: $ZSH_VERSION!" elif [ -n "${BASH_SOURCE-}" ] then - eval "$(env LANG=en _IDF.PY_COMPLETE=$SOURCE_BASH idf.py)" || echo "WARNING: Failed to load shell autocompletion for bash version: $BASH_VERSION!" + WARNING_MSG="WARNING: Failed to load shell autocompletion for bash version: $BASH_VERSION!" + [[ ${BASH_VERSINFO[0]} -lt 4 ]] && { echo "$WARNING_MSG"; return; } + eval "$(env LANG=en _IDF.PY_COMPLETE=$SOURCE_BASH idf.py)" || echo "$WARNING_MSG" fi }