mirror of
https://github.com/rcaloras/bash-preexec.git
synced 2026-11-03 22:49:41 -09:00
Don't load if old version already present (Fixes rcaloras/bash-preexec#146) (#150)
This commit is contained in:
parent
fb23d474b3
commit
f872f3fff2
2 changed files with 7 additions and 1 deletions
|
|
@ -48,7 +48,7 @@ if [[ -z "${BASH_VERSINFO-}" ]] || (( BASH_VERSINFO[0] < 3 || (BASH_VERSINFO[0]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Avoid duplicate inclusion
|
# Avoid duplicate inclusion
|
||||||
if [[ -n "${bash_preexec_imported:-}" ]]; then
|
if [[ -n "${bash_preexec_imported:-}" || -n "${__bp_imported:-}" ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
bash_preexec_imported="defined"
|
bash_preexec_imported="defined"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,12 @@
|
||||||
[ -z $(type -t __bp_install) ]
|
[ -z $(type -t __bp_install) ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "should not import if it's already defined (old guard, don't use elsewhere!)" {
|
||||||
|
__bp_imported="defined"
|
||||||
|
source "${BATS_TEST_DIRNAME}/../bash-preexec.sh"
|
||||||
|
[ -z $(type -t __bp_install) ]
|
||||||
|
}
|
||||||
|
|
||||||
@test "should import if not defined" {
|
@test "should import if not defined" {
|
||||||
unset bash_preexec_imported
|
unset bash_preexec_imported
|
||||||
source "${BATS_TEST_DIRNAME}/../bash-preexec.sh"
|
source "${BATS_TEST_DIRNAME}/../bash-preexec.sh"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue