GitHub

Original file line numberDiff line numberDiff line change

@@ -48,7 +48,7 @@ if [[ -z "${BASH_VERSINFO-}" ]] || (( BASH_VERSINFO[0] < 3 || (BASH_VERSINFO[0]

4848

fi

4949
5050

# Avoid duplicate inclusion

51-

if [[ -n "${bash_preexec_imported:-}" ]]; then

51+

if [[ -n "${bash_preexec_imported:-}" || -n "${__bp_imported:-}" ]]; then

5252

return 0

5353

fi

5454

bash_preexec_imported="defined"

Original file line numberDiff line numberDiff line change

@@ -6,6 +6,12 @@

66

[ -z $(type -t __bp_install) ]

77

}

88
9+

@test "should not import if it's already defined (old guard, don't use elsewhere!)" {

10+

__bp_imported="defined"

11+

source "${BATS_TEST_DIRNAME}/../bash-preexec.sh"

12+

[ -z $(type -t __bp_install) ]

13+

}

14+
915

@test "should import if not defined" {

1016

unset bash_preexec_imported

1117

source "${BATS_TEST_DIRNAME}/../bash-preexec.sh"

Read the original on github.com ↗