Exit code isn't handled correctly in fish shell integration
#169.407 geöffnet am 16. Dez. 2022
Repository-Metriken
- Stars
- (74.848 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 11h 43m) (1.000 gemergte PRs in 30 T)
Beschreibung
@Tyriar The new
fish_promptfunction does not work properly in my case. My fish configuration uses a right prompt and shows the exit code of the command (green check mark). The exit code is always shown as good, even if the executed program returns a non-0 code. The right prompt is also misaligned. It is one line below where it is supposed to be.
The status code issue seems to be caused by executing
__vsc_fish_prompt_startfirst, because this will overwrite$statusand$pipestatus. The misaligned right prompt seems to relate to some newline shenanigans fish does. It removes the last newline from the prompt, but since__vsc_fish_cmd_startis after the prompt it doesn't work any longer. I found these related links: https://github.com/kovidgoyal/kitty/issues/4032, https://github.com/kovidgoyal/kitty/commit/f277cbf3f3fe03cecaec7e619bf8d8970d945dfaIf I change the above snippet to this it seems to work better for me.
# No fish_mode_prompt, so put everything in fish_prompt. function fish_prompt set --local prompt (__vsc_fish_prompt) __vsc_fish_prompt_start if set -q prompt[2] builtin printf '%s\n' $prompt[1..-2] # print all but last element of array, each followed by a new line end builtin printf '%s' $prompt[-1] # print the last component without a newline __vsc_fish_cmd_start end
Originally reported by @jonasbb at https://github.com/microsoft/vscode/issues/139400#issuecomment-1232759033
