functions.sh: fix GLOBAL_CACHE error whay array does not yet exist

pull/1/head jm_3640af68
Jason Mehring 9 years ago
parent 2167225d01
commit 3640af684f

@ -167,7 +167,7 @@ error() {
setArrayAsGlobal() { setArrayAsGlobal() {
local array="$1" local array="$1"
local export_as="$2" local export_as="$2"
local code=$(declare -p "$array") local code=$(declare -p "$array" 2> /dev/null || true)
local replaced="${code/$array/$export_as}" local replaced="${code/$array/$export_as}"
eval ${replaced/declare -/declare -g} eval ${replaced/declare -/declare -g}
} }
@ -407,7 +407,7 @@ getFileLocations() {
local function="templateFile" local function="templateFile"
unset GLOBAL_CACHE unset GLOBAL_CACHE
declare -A -g GLOBAL_CACHE declare -gA GLOBAL_CACHE
callTemplateFunction "${filename}" "${suffix}" "${function}" callTemplateFunction "${filename}" "${suffix}" "${function}"
setArrayAsGlobal GLOBAL_CACHE $return_global_var setArrayAsGlobal GLOBAL_CACHE $return_global_var

Loading…
Cancel
Save