Merge pull request #709 from claui/fix-osx-subshell-prompt

Preserve `PROMPT_COMMAND` exportedness for subshells
pull/1048/head
Nils Winkler 2017-09-17 20:47:02 +02:00 committed by GitHub
commit 2742adbeaa
1 changed files with 4 additions and 1 deletions

View File

@ -5,7 +5,10 @@ about-plugin 'osx-specific functions'
if [ $(uname) = "Darwin" ]; then
if type update_terminal_cwd > /dev/null 2>&1 ; then
if ! [[ $PROMPT_COMMAND =~ (^|;)update_terminal_cwd($|;) ]] ; then
export PROMPT_COMMAND="$PROMPT_COMMAND;update_terminal_cwd"
PROMPT_COMMAND="$PROMPT_COMMAND;update_terminal_cwd"
declared="$(declare -p PROMPT_COMMAND)"
[[ "$declared" =~ \ -[aAilrtu]*x[aAilrtu]*\ ]] 2>/dev/null
[[ $? -eq 0 ]] && export PROMPT_COMMAND
fi
fi
fi