summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Song <4605384+chipbuster@users.noreply.github.com>2021-01-07 11:15:43 -0600
committerGitHub <noreply@github.com>2021-01-07 18:15:43 +0100
commit55c3cafd9470837cc99e4fa68a6dd932f365caf4 (patch)
tree3936e8d74191682d8984ecdf11fae29054d1cf81
parent435ec17b42ae0f53c2e77a46fabb79f2f0db93db (diff)
fix(bash): bash-preexec detection and implementation (#2091)
* Fix bash-preexec detection and implementation * Add detection for other arrays
-rw-r--r--src/init/starship.bash6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/init/starship.bash b/src/init/starship.bash
index 2d1eb84cb..09dbb7b18 100644
--- a/src/init/starship.bash
+++ b/src/init/starship.bash
@@ -56,8 +56,10 @@ starship_precmd() {
# If the user appears to be using https://github.com/rcaloras/bash-preexec,
# then hook our functions into their framework.
-if [[ $preexec_functions ]]; then
- preexec_functions+=('starship_preexec "$_"')
+if [[ "${__bp_imported:-}" == "defined" || $preexec_functions || $precmd_functions ]]; then
+ # bash-preexec needs a single function--wrap the args into a closure and pass
+ starship_preexec_all(){ starship_preexec "$_"; }
+ preexec_functions+=(starship_preexec_all)
precmd_functions+=(starship_precmd)
else
# We want to avoid destroying an existing DEBUG hook. If we detect one, create