From 2aa711ccc7096437e21149b18d1384534bfbcc57 Mon Sep 17 00:00:00 2001 From: David Knaack Date: Sun, 4 Feb 2024 16:02:17 +0100 Subject: [PATCH] fix(bash): improve integration with bash-preexec (#5734) --- src/init/starship.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init/starship.bash b/src/init/starship.bash index d48ce46d35b0..c59fb5a4ae87 100644 --- a/src/init/starship.bash +++ b/src/init/starship.bash @@ -36,7 +36,7 @@ starship_precmd() { if [[ ${BLE_ATTACHED-} && ${#BLE_PIPESTATUS[@]} -gt 0 ]]; then STARSHIP_PIPE_STATUS=("${BLE_PIPESTATUS[@]}") fi - if [[ -n "${BP_PIPESTATUS-}" ]] && [[ "${#BP_PIPESTATUS[@]}" -gt "${#STARSHIP_PIPE_STATUS[@]}" ]]; then + if [[ -n "${BP_PIPESTATUS-}" ]] && [[ "${#BP_PIPESTATUS[@]}" -gt 0 ]]; then STARSHIP_PIPE_STATUS=(${BP_PIPESTATUS[@]}) fi @@ -92,7 +92,7 @@ if [[ ${BLE_VERSION-} && _ble_version -ge 400 ]]; then blehook PRECMD!='starship_precmd' # If the user appears to be using https://github.com/rcaloras/bash-preexec, # then hook our functions into their framework. -elif [[ "${__bp_imported:-}" == "defined" || -n "${preexec_functions-}" || -n "${precmd_functions-}" ]]; then +elif [[ -n "${bash_preexec_imported:-}" || -n "${__bp_imported:-}" || -n "${preexec_functions-}" || -n "${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)