@@ -110,39 +110,42 @@ __vsc_precmd() {
110
110
}
111
111
112
112
__vsc_preexec () {
113
- if [ " $__vsc_in_command_execution " = " 0" ]; then
114
- __vsc_initialized=1
115
- __vsc_in_command_execution=" 1"
116
- if [[ ! " $BASH_COMMAND " =~ ^__vsc_prompt* ]]; then
117
- __vsc_current_command=$BASH_COMMAND
118
- else
119
- __vsc_current_command=" "
120
- fi
121
- __vsc_command_output_start
113
+ __vsc_initialized=1
114
+ if [[ ! " $BASH_COMMAND " =~ ^__vsc_prompt* ]]; then
115
+ __vsc_current_command=$BASH_COMMAND
116
+ else
117
+ __vsc_current_command=" "
122
118
fi
119
+ __vsc_command_output_start
123
120
}
124
121
125
122
# Debug trapping/preexec inspired by starship (ISC)
126
123
if [[ -n " ${bash_preexec_imported:- } " ]]; then
127
124
__vsc_preexec_only () {
128
- __vsc_status=" $? "
129
- __vsc_preexec
125
+ if [ " $__vsc_in_command_execution " = " 0" ]; then
126
+ __vsc_in_command_execution=" 1"
127
+ __vsc_preexec
128
+ fi
130
129
}
131
130
precmd_functions+=(__vsc_prompt_cmd)
132
131
preexec_functions+=(__vsc_preexec_only)
133
132
else
134
133
__vsc_dbg_trap=" $( trap -p DEBUG | cut -d' ' -f3 | tr -d \' ) "
135
134
if [[ -z " $__vsc_dbg_trap " ]]; then
136
135
__vsc_preexec_only () {
137
- __vsc_status=" $? "
138
- __vsc_preexec
136
+ if [ " $__vsc_in_command_execution " = " 0" ]; then
137
+ __vsc_in_command_execution=" 1"
138
+ __vsc_preexec
139
+ fi
139
140
}
140
141
trap ' __vsc_preexec_only "$_"' DEBUG
141
142
elif [[ " $__vsc_dbg_trap " != ' __vsc_preexec "$_"' && " $__vsc_dbg_trap " != ' __vsc_preexec_all "$_"' ]]; then
142
143
__vsc_preexec_all () {
143
- __vsc_status=" $? "
144
- builtin eval ${__vsc_dbg_trap}
145
- __vsc_preexec
144
+ if [ " $__vsc_in_command_execution " = " 0" ]; then
145
+ __vsc_in_command_execution=" 1"
146
+ builtin eval ${__vsc_dbg_trap}
147
+ __vsc_preexec
148
+ fi
146
149
}
147
150
trap ' __vsc_preexec_all "$_"' DEBUG
148
151
fi
151
154
__vsc_update_prompt
152
155
153
156
__vsc_prompt_cmd_original () {
157
+ __vsc_status=" $? "
154
158
if [[ ${IFS+set} ]]; then
155
159
__vsc_original_ifs=" $IFS "
156
160
fi
0 commit comments