Skip to content

Fix Simplify bash PROMPT_COMMAND handling commit#157631

Merged
Tyriar merged 3 commits into
microsoft:mainfrom
emeric-martineau:fix/prompt_command
Aug 10, 2022
Merged

Fix Simplify bash PROMPT_COMMAND handling commit#157631
Tyriar merged 3 commits into
microsoft:mainfrom
emeric-martineau:fix/prompt_command

Conversation

@emeric-martineau

@emeric-martineau emeric-martineau commented Aug 9, 2022

Copy link
Copy Markdown
Contributor

Fix @Tyriar commit dfc99af 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 #157206

@meganrogge

Copy link
Copy Markdown
Collaborator

related #157206

Comment thread src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh Outdated
Comment thread src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh Outdated
@meganrogge meganrogge requested a review from Tyriar August 9, 2022 17:56
@meganrogge meganrogge added this to the August 2022 milestone Aug 9, 2022
@BMBurstein

Copy link
Copy Markdown
Contributor

Should fix #157294

@Tyriar Tyriar merged commit 9a9378d into microsoft:main Aug 10, 2022
joyceerhl pushed a commit that referenced this pull request Aug 10, 2022
Fix Simplify bash PROMPT_COMMAND handling commit
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VSCode and starship prompt not working as expected after the latest update V1.70.0

4 participants