vscode
vscode copied to clipboard
Fix Simplify bash PROMPT_COMMAND handling commit
Fix @Tyriar commit dfc99af92ae923841caa055260deac9b61570725 Simplify bash PROMPT_COMMAND handling.
What's happend ?
I use a modified PS1 for bash prompt:
function _update_ps1() {
PS1="$(/usr/local/bin/powerline-go -error $? -jobs $(jobs -p | /usr/bin/wc -l) -modules "user,host,cwd,perms,git,hg,jobs,exit,root")"
}
if [ "$TERM" != "linux" ] && [ -f "/usr/local/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
It works fine without VSCode terminal integration. $? return last exit code of command.
But, since VSCode 1.7.0, $? return value of [[ ${#__vsc_original_prompt_command[@]} -gt 1 ]] line (line 161).
In my case, $? return always error.
Debug trace:
+ builtin unset VSCODE_INJECTION
...
++ __vsc_status=0
++ [[ 1 -gt 1 ]]
++ eval '_update_ps1; '
+++ _update_ps1
+++++ /usr/bin/wc -l
+++++ jobs -p
++++ /usr/local/bin/powerline-go -error 1 -jobs 0 -modules user,host,cwd,perms,git,hg,jobs,exit,root
+++ PS1='\[\e[38;5;250m\]\[\e[48;5;240m\] vagrant \[\e[48;5;238m\]\[\e[38;5;240m\]\[\e[0m\]\[\e[38;5;250m\]\[\e[48;5;238m\] mv-ulm \[\e[48;5;31m\]\[\e[38;5;238m\]\[\e[0m\]\[\e[38;5;15m\]\[\e[48;5;31m\] ~ \[\e[48;5;161m\]\[\e[38;5;31m\]\[\e[0m\]\[\e[38;5;15m\]\[\e[48;5;161m\] ERROR \[\e[48;5;161m\]\[\e[38;5;161m\]\[\e[0m\]\[\e[38;5;15m\]\[\e[48;5;161m\] \$ \[\e[0m\]\[\e[38;5;161m\]\[\e[0m\] '
In my case, $? return value of [[ 1 -gt 1 ]].
fixes https://github.com/microsoft/vscode/issues/157206
related https://github.com/microsoft/vscode/issues/157206
Should fix #157294