Skip to content

Bash shell integration -- exit code is not restored when PROMPT_COMMAND is an array#158091

Merged
Tyriar merged 5 commits into
microsoft:mainfrom
CyrilOtheninGirard:exit-code-is-not-restored-when-PROMPT_COMMAND-is-an-array
Oct 6, 2022
Merged

Bash shell integration -- exit code is not restored when PROMPT_COMMAND is an array#158091
Tyriar merged 5 commits into
microsoft:mainfrom
CyrilOtheninGirard:exit-code-is-not-restored-when-PROMPT_COMMAND-is-an-array

Conversation

@CyrilOtheninGirard

Copy link
Copy Markdown
Contributor

This solves issue #158090 "Bash shell integration -- exit code is not restored when PROMPT_COMMAND is an array".

Note: this fix also works when PROMPT_COMMAND is not an array, because in BASH you can apply the array syntax on single (i.e. non-array) variable.

Example : "$xxx" == "${xxx[0]}" whatever the type of xxx: a single variable or an array.

When the original PROMPT_COMMAND is an array:
# exit code of last executed command was not restored before executing the commands stored inside the original PROMPT_COMMAND array
# __vsc_status was assigned the exit code of the penultimate command stored inside the original PROMPT_COMMAND array

Note: the proposed fix also works when PROMPT_COMMAND is not an array
@CyrilOtheninGirard
CyrilOtheninGirard force-pushed the exit-code-is-not-restored-when-PROMPT_COMMAND-is-an-array branch from 8ec0f7d to 880ffb6 Compare August 13, 2022 19:54
@Tyriar Tyriar added this to the October 2022 milestone Oct 3, 2022
@meganrogge
meganrogge self-requested a review October 6, 2022 14:23

@meganrogge meganrogge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented on the issue bc cannot repro in Insider's

EDIT: can reproduce the second issue

@meganrogge
meganrogge self-requested a review October 6, 2022 15:36
@meganrogge
meganrogge requested a review from Tyriar October 6, 2022 15:39
@Tyriar
Tyriar merged commit 1edf758 into microsoft:main Oct 6, 2022
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 20, 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.

3 participants