Don't add our prompt_command twice, also prepend

During testing if you source it twice you get
that problem now.

The error code formatting/logging gets broken if
we run prompt_command after other stuff. Running
anything external obviously resets $?.
This commit is contained in:
Doncho N. Gunchev 2020-10-17 12:22:46 +03:00
parent 4fe20ce6c9
commit 54ccd1efb9

View file

@ -154,7 +154,10 @@ ${C2})${C3}\$${NO_COLOUR} "
if [ -z "${PROMPT_COMMAND}" ]; then
export PROMPT_COMMAND=prompt_command
else
export PROMPT_COMMAND="${PROMPT_COMMAND}; prompt_command"
if ! echo "${PROMPT_COMMAND}" | grep '\bprompt_command\b' > /dev/null 2>&1; then
export PROMPT_COMMAND="prompt_command
${PROMPT_COMMAND}"
fi
fi
trap prompt_command_exit EXIT
shopt -s cmdhist histappend