_LAST_COMMAND_INDICATOR_ always OK
LAST_COMMAND_INDICATOR always shows gree/ok
13:21 $ pushd ~/DBs/git/minimal/minimal_spring_cloud_stream_rabbit/src/main/java/com/dellemc/scsrabbit
~/DBs/git/minimal/minimal_spring_cloud_stream_rabbit/src/main/java/com/dellemc/scsrabbit ~
✔ hoffmd9:.../main/java/com/dellemc/scsrabbit [master|✔]
13:21 $ asdf
-bash: asdf: command not found
✔ hoffmd9:.../main/java/com/dellemc/scsrabbit [master|✔]
13:21 $ echo $?
127
~/.bashrc
GIT_PROMPT_THEME=Custom
if [ -f "/usr/local/opt/bash-git-prompt/share/gitprompt.sh" ]; then
__GIT_PROMPT_DIR="/usr/local/opt/bash-git-prompt/share"
source "/usr/local/opt/bash-git-prompt/share/gitprompt.sh"
fi
~/.git-prompt-colors.sh
override_git_prompt_colors() {
#GIT_PROMPT_THEME_NAME="Solarized"
GIT_PROMPT_THEME_NAME="Custom"
#Overrides the prompt_callback function used by bash-git-prompt
function prompt_callback {
local PS1="\u:$(gp_truncate_pwd 35)"
echo -n "_LAST_COMMAND_INDICATOR_ ${Yellow}${PS1}${ResetColor}"
}
GIT_PROMPT_COMMAND_OK="${Green}✔ " # displays as ✔
GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # displays as ✘-1 for exit code 1
GIT_PROMPT_START_USER=""
GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ "
GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} ${BoldRed}# "
GIT_PROMPT_STAGED="${Yellow}●"
GIT_PROMPT_STASHED="${BoldMagenta}⚑ "
GIT_PROMPT_CLEAN="${Green}✔"
}
reload_git_prompt_colors "Custom"
what am I doing wrong?
MacOS 10 (High Sierra) iTerm2 3.3
I had this issue and I discovered it was due to my PROMPT_COMMAND.
I had export PROMPT_COMMAND="history -a; $PROMPT_COMMAND" and the error code was clearly swallowed by the history -a.
I fixed it with export PROMPT_COMMAND="$PROMPT_COMMAND; history -a"
I hope it helps
I recently pulled the latest master and the indicator stopped working for me. Now I get the tick constantly as per OP. Don't have anything like the PROMPT_COMMAND explicitly set, using the repo as is with no changes besides doing a pull.
Last change was almost a year ago any clearly everything's working for majority of the users.
What's your PS1 and PROMPT_COMMAND values?
The last change might have been over a year ago, but I only updated recently. I'd argue not many people update this after installing so would not get the issue and new users would not know it should be showing an :x:
I know my collegue on mac has the same issue as he only installed from fresh recently
My .bashrc is un-modified from the ubuntu default, besides adding bash git prompt.
$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
$ echo $PROMPT_COMMAND
preexec_set_exit;setLastCommandState;setGitPrompt;preexec_invoke_cmd
Could you try without preexec_set_exit & preexec_invoke_cmd just in case? Can't recognize those.
Maybe some of those is swallowing the exit code, similar to what happened to the user above with history -a?
Actually scrap my comments, I've forgotten I stopped using command indication from bash-git-prompt some time ago; now I have this bit in PS1 that only shows a red X if command was unsuccessful, otherwise stays blank:
\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")