Shell integration turns off after first command when installed with another PS1-affecting PROMPT_COMMAND
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: 3.1.beta.6
- OS version: 10.12.6
- Attach ~/Library/Preferences/com.googlecode.iterm2.plist here (drag-drop from finder into this window): N/A
- Attach a debug log, if possible. Instructions at https://iterm2.com/debuglog: N/A
Detailed steps to reproduce the problem:
- Install shell integration
- Open new shell session
- Run any command
What happened: shell integration escape codes aren't added to prompt
What should have happened: shell integration escape codes should've been added to prompt
Here's the PROMPT_COMMAND
I have and the code that sets it:
set_prompt() {
...
export PS1="stuff"
}
if [ -n "$PROMPT_COMMAND" ]; then
PROMPT_COMMAND="$PROMPT_COMMAND; set_prompt"
else
PROMPT_COMMAND="set_prompt"
fi
My ~/.profile
:
if [ -n "$BASH_VERSION" ]; then
. $HOME/.bashrc
fi
test -e ${HOME}/.iterm2_shell_integration.bash && source ${HOME}/.iterm2_shell_integration.bash
Additional debug info:
$ echo $PROMPT_COMMAND
__bp_precmd_invoke_cmd; another_command; set_prompt; __bp_interactive_mode
As far as I can tell, this is set up the way the shell integration wants it to, according to .iterm2_shell_integration.bash:306
:
PROMPT_COMMAND="__bp_precmd_invoke_cmd; ${existing_prompt_command} __bp_interactive_mode"
Still, it seems as if my PS1
-setting prompt command is overwriting iTerm's.