Skip to content
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

Fix first command in zsh not getting right exit code #151222

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ if [ -z "$VSCODE_SHELL_INTEGRATION" ]; then
builtin return
fi

__vsc_initialized="0"
__vsc_in_command_execution="1"
__vsc_last_history_id=0

Expand Down Expand Up @@ -58,11 +59,14 @@ __vsc_right_prompt_end() {

__vsc_command_complete() {
builtin local __vsc_history_id=$(builtin history | tail -n1 | awk '{print $1;}')
if [[ "$__vsc_history_id" == "$__vsc_last_history_id" ]]; then
builtin printf "\033]633;D\007"
else
builtin printf "\033]633;D;%s\007" "$__vsc_status"
__vsc_last_history_id=$__vsc_history_id
# Don't write the command complete sequence for the first prompt without an associated command
if [[ "$__vsc_initialized" == "1" ]]; then
if [[ "$__vsc_history_id" == "$__vsc_last_history_id" ]]; then
builtin printf "\033]633;D\007"
else
builtin printf "\033]633;D;%s\007" "$__vsc_status"
__vsc_last_history_id=$__vsc_history_id
fi
fi
__vsc_update_cwd
}
Expand Down Expand Up @@ -99,6 +103,7 @@ __vsc_preexec() {
if [ -n "$RPROMPT" ]; then
RPROMPT="$__vsc_prior_rprompt"
fi
__vsc_initialized="1"
__vsc_in_command_execution="1"
__vsc_command_output_start
}
Expand Down