Skip to content

Simplify bash PROMPT_COMMAND handling - #155741

Merged
Daniel Imms (Tyriar) merged 1 commit into
mainfrom
tyriar/155648
Jul 20, 2022
Merged

Simplify bash PROMPT_COMMAND handling#155741
Daniel Imms (Tyriar) merged 1 commit into
mainfrom
tyriar/155648

Conversation

@Tyriar

@Tyriar Daniel Imms (Tyriar) commented Jul 20, 2022

Copy link
Copy Markdown
Contributor

This change attempts to evaluate PROMPT_COMMAND in the same way that
bash would, adding support or many more cases and removing the check
that disables unsupported PROMPT_COMMANDS.

Fixes #155221
Fixes #146197


Tested true/false exit codes with:

  • Simple PS1
  • PROMPT_COMMAND echo
  • PROMPT_COMMAND function
  • PROMPT_COMMAND ;
  • PROMPT COMMAND &&
  • Starship
  • oh-my-posh
  • git-bash-prompt
  • preexec integration

It's possible PROMPT_COMMAND of the form ("first" "second") aren't working correctly, but I didn't totally understand how it's meant to be handled as no shell integration only seems to evaluate "first" in that case which we do.

FYI Megan Rogge (@meganrogge)

This change attempts to evaluate PROMPT_COMMAND in the same way that
bash would, adding support or many more cases and removing the check
that disables unsupported PROMPT_COMMANDS.

Fixes #155221
Fixes #146197
@Tyriar Daniel Imms (Tyriar) added this to the July 2022 milestone Jul 20, 2022
@Tyriar Daniel Imms (Tyriar) self-assigned this Jul 20, 2022
@Tyriar
Daniel Imms (Tyriar) merged commit 316cf3e into main Jul 20, 2022
@Tyriar
Daniel Imms (Tyriar) deleted the tyriar/155648 branch July 20, 2022 15:00
@meganrogge

Copy link
Copy Markdown
Collaborator

Yep I was aware that other terminals with shell integration also don't support that kind of valid syntax. This looks much simpler, so probably not worth the added complexity to support it

@github-actions github-actions Bot locked and limited conversation to collaborators Sep 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

3 participants