From 4a8b76f815152f12546d3da75b1acebcef24475f Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Sat, 4 Jun 2022 14:43:27 +0200 Subject: [PATCH] exec_opkg_commands() using exec_process_substitution() --- update_psa_helpers | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) mode change 100644 => 100755 update_psa_helpers diff --git a/update_psa_helpers b/update_psa_helpers old mode 100644 new mode 100755 index 60520d7..d9bde06 --- a/update_psa_helpers +++ b/update_psa_helpers @@ -6,25 +6,16 @@ # return 0 #fi +source ./general_utils + exec_opkg_command () { local func="${FUNCNAME[0]}" - log_debug "$func:${LINENO} exec-ing [$*]" - exec {fd}< <(eval "$@") - local ps_pid=$! # remember pid of process substitution + local __result=$(exec_process_substitution $*) + log_debug "$func:${LINENO} result=$__result" - local opkg_result="" - while read tmp <&$fd; do - if ! [ -z "$tmp" ]; then - opkg_result="${opkg_result}$tmp" - fi - done - - exec {fd}>&- # close fd (i.e. process substitution) - wait $ps_pid # wait for the subshell to finish - - printf '%s' "$opkg_result" + printf '%s' "$__result" } # Fetch/merge updates from predefined repository using git.