From fc3cc6b6e3d444af6bcec0c463e58a11d2de1a49 Mon Sep 17 00:00:00 2001 From: diverger Date: Sun, 21 Sep 2025 23:20:57 +0800 Subject: [PATCH] fix(build): eliminate the error message when no extension found in a folder in building In the building when there is not any extensions with given pattern exist, 'enable_extensions_with_hostdeps_builtin_and_user()' will throw errors such as: 'Error 123 occurred in SUBSHELL SUBSHELL at //lib/functions/general/extensions.sh:582'. The changes will eliminate the error message and add prints to show the current searched folder and extensions count found in the folder. Signed-off-by: diverger --- lib/functions/general/extensions.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/functions/general/extensions.sh b/lib/functions/general/extensions.sh index 280e2fa9d..f599402c9 100644 --- a/lib/functions/general/extensions.sh +++ b/lib/functions/general/extensions.sh @@ -577,10 +577,14 @@ function enable_extensions_with_hostdeps_builtin_and_user() { # Extensions are files of the format /extension_name.sh or /extension_name/extension_name.sh for ext_dir in "${ext_dirs[@]}"; do + display_alert "Extension search" "Searching in directory: \"${ext_dir}\"" "" if [[ -d "${ext_dir}" ]]; then declare -a ext_list_dir=() - mapfile -t ext_list_dir < <(find "${ext_dir}" -maxdepth 2 -type f -name "*.sh" -print0 | xargs -0 grep -l "${grep_args[@]}") + mapfile -t ext_list_dir < <(find "${ext_dir}" -maxdepth 2 -type f -name "*.sh" -print0 | xargs -0 -r grep -l "${grep_args[@]}" 2>/dev/null || true) + display_alert "Extension search result" "Found ${#ext_list_dir[@]} extensions in \"${ext_dir}\"" "" extension_list+=("${ext_list_dir[@]}") + else + display_alert "Extension search" "Directory does not exist: \"${ext_dir}\"" "wrn" fi done