Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@emeric-martineau
Copy link
Contributor

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

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
Contributor

related #157206

@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
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.