Skip to content

Commit 0bb6431

Browse files
committed
fix: Move variable initialization to init function
This ensures soucing the function properly has effectively no relevant side effects
1 parent 991c463 commit 0bb6431

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/lib/public/bash-core.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# shellcheck shell=bash
22

3-
declare -Ag ___global_trap_table___=()
4-
declare -ag ___global_shopt_stack___=()
3+
core.init() {
4+
if [ ${___global_bash_core_has_init__+x} ]; then
5+
return
6+
fi
7+
8+
___global_bash_core_has_init__=
9+
declare -Ag ___global_trap_table___=()
10+
declare -ag ___global_shopt_stack___=()
11+
}
512

613
# @description Get version of the package, from the point of the
714
# callsite. In other words, it returns the version of the package

0 commit comments

Comments
 (0)