-
-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning code always 0 in VS Code terminal #595
Comments
It works as expected in my environment (the printed code changes depending on the exit status of the previous command). Do you load other frameworks? What is the result of $ declare -p PROMPT_COMMAND |
@Gaurav9812 Your account is likely to be hijacked. That link is reported as a virus. Currently, a massive number of messages of the same malicious content seem to be posted by different users (which includes various types of inactive users seemingly owned by real people): |
The result of
I've just realized the problem occurs inside VS Code terminal. |
The upstream integration code is clearly broken. __vsc_prompt_cmd_original() {
__vsc_status="$?"
__vsc_restore_exit_code "${__vsc_status}"
# Evaluate the original PROMPT_COMMAND similarly to how bash would normally
# See https://unix.stackexchange.com/a/672843 for technique
builtin local cmd
for cmd in "${__vsc_original_prompt_command[@]}"; do
eval "${cmd:-}"
done
__vsc_precmd
} While it saves the exit status in the variable Edit: The issue is also reported in the upstream: |
The fix in VSCode seems to have been released in 1.93.0. @hgsantana Could you check if the problem is fixed? |
I've been trying to customize a new theme for my needs, and I was trying to use
robbyrussell
theme as the base for it. When I tried thefalse
command using this theme it didn't apply the brown color to the arrow as it was supposed to do.So I tried to debug it and placed an "echo $?" just inside the function that generates de prompt:
Even typing false on prompt, the return code is always 0:
The if statement would always be 0 after I added the new line, since echo returns 0 on success. Nevertheless, the print of
$?
is always 0 inside the echo command. Something before this function is returning 0 and is not the command executed on prompt.The text was updated successfully, but these errors were encountered: