@@ -44,8 +44,14 @@ function bashunit::main::cmd_test() {
4444 export BASHUNIT_PARALLEL_RUN=false
4545 ;;
4646 -e|--env|--boot)
47- # shellcheck disable=SC1090
48- source " $2 "
47+ # Support: --env "bootstrap.sh arg1 arg2"
48+ local boot_file=" ${2%% * } "
49+ local boot_args=" ${2#* } "
50+ if [[ " $boot_args " != " $2 " ]]; then
51+ export BASHUNIT_BOOTSTRAP_ARGS=" $boot_args "
52+ fi
53+ # shellcheck disable=SC1090,SC2086
54+ source " $boot_file " ${BASHUNIT_BOOTSTRAP_ARGS:- }
4955 shift
5056 ;;
5157 -l|--log-junit)
@@ -139,8 +145,8 @@ function bashunit::main::cmd_test() {
139145 fi
140146
141147 # Optional bootstrap
142- # shellcheck disable=SC1090
143- [[ -f " ${BASHUNIT_BOOTSTRAP:- } " ]] && source " $BASHUNIT_BOOTSTRAP "
148+ # shellcheck disable=SC1090,SC2086
149+ [[ -f " ${BASHUNIT_BOOTSTRAP:- } " ]] && source " $BASHUNIT_BOOTSTRAP " ${BASHUNIT_BOOTSTRAP_ARGS :- }
144150
145151 if [[ " ${BASHUNIT_NO_OUTPUT:- false} " == true ]]; then
146152 exec > /dev/null 2>&1
@@ -183,8 +189,14 @@ function bashunit::main::cmd_bench() {
183189 export BASHUNIT_SIMPLE_OUTPUT=false
184190 ;;
185191 -e|--env|--boot)
186- # shellcheck disable=SC1090
187- source " $2 "
192+ # Support: --env "bootstrap.sh arg1 arg2"
193+ local boot_file=" ${2%% * } "
194+ local boot_args=" ${2#* } "
195+ if [[ " $boot_args " != " $2 " ]]; then
196+ export BASHUNIT_BOOTSTRAP_ARGS=" $boot_args "
197+ fi
198+ # shellcheck disable=SC1090,SC2086
199+ source " $boot_file " ${BASHUNIT_BOOTSTRAP_ARGS:- }
188200 shift
189201 ;;
190202 -vvv|--verbose)
@@ -211,8 +223,8 @@ function bashunit::main::cmd_bench() {
211223 fi
212224
213225 # Optional bootstrap
214- # shellcheck disable=SC1090
215- [[ -f " ${BASHUNIT_BOOTSTRAP:- } " ]] && source " $BASHUNIT_BOOTSTRAP "
226+ # shellcheck disable=SC1090,SC2086
227+ [[ -f " ${BASHUNIT_BOOTSTRAP:- } " ]] && source " $BASHUNIT_BOOTSTRAP " ${BASHUNIT_BOOTSTRAP_ARGS :- }
216228
217229 set +euo pipefail
218230
0 commit comments