Skip to content

Commit 74cd7eb

Browse files
committed
fix: Remove 'eval' for good
Forgot about this eval; now it's taken care of
1 parent cfda2c5 commit 74cd7eb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/lib/traverse-set.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ bash_object.traverse-set() {
223223
fi
224224

225225
if ! declare -gA "$global_object_name"; then
226-
bash_object.util.die 'ERROR_INTERNAL' 'Eval declare failed'
226+
bash_object.util.die 'ERROR_INTERNAL' "Could not declare variable '$global_object_name'"
227227
return
228228
fi
229229
local -n global_object="$global_object_name"
@@ -245,14 +245,15 @@ bash_object.traverse-set() {
245245
return
246246
fi
247247

248-
if ! eval "declare -ga $global_array_name=()" 2>/dev/null; then
249-
bash_object.util.die 'ERROR_INTERNAL' 'Eval declare failed'
248+
if ! declare -ga "$global_array_name"; then
249+
bash_object.util.die 'ERROR_INTERNAL' "Could not declare variable $global_object_name"
250250
return
251251
fi
252+
local -n global_array="$global_array_name"
253+
global_array=()
252254

253255
current_object["$key"]=$'\x1C\x1D'"type=array;&$global_array_name"
254256

255-
local -n global_array="$global_array_name"
256257
local -n array_to_copy_from="$final_value"
257258

258259
# shellcheck disable=SC2034

0 commit comments

Comments
 (0)