exec_opkg_commands() using exec_process_substitution()
This commit is contained in:
parent
4989ee8d05
commit
4a8b76f815
19
update_psa_helpers
Normal file → Executable file
19
update_psa_helpers
Normal file → Executable file
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user