@@ -169,6 +169,22 @@ function RunDebugger(frame, repl = nothing, terminal = nothing; initial_continue
169
169
return state. overall_result
170
170
end
171
171
172
+ @static if VERSION ≥ v " 1.11.5"
173
+ # Starting from https://github.com/JuliaLang/julia/pull/57773, `print_response`
174
+ # hands over the evaluation to the backend using a `Channel` for synchronization.
175
+ # However, this causes a deadlock for Debugger because we call this from the backend already.
176
+ function print_response (repl, response, show_value:: Bool , have_color:: Bool )
177
+ repl. waserror = response[2 ]
178
+ backend = nothing # don't defer evaluation to the REPL backend, do it eagerly.
179
+ REPL. with_repl_linfo (repl) do io
180
+ io = IOContext (io, :module => Base. active_module (repl):: Module )
181
+
182
+ REPL. print_response (io, response, backend, show_value, have_color, REPL. specialdisplay (repl))
183
+ end
184
+ end
185
+ else
186
+ print_response (repl, response, show_value:: Bool , have_color:: Bool ) = REPL. print_response (repl, response, show_value, have_color)
187
+ end
172
188
173
189
function julia_prompt (state:: DebuggerState )
174
190
# Return early if this has already been called on the state
@@ -190,16 +206,7 @@ function julia_prompt(state::DebuggerState)
190
206
end
191
207
command = String (take! (buf))
192
208
response = _eval_code (active_frame (state), command)
193
- @static if VERSION >= v " 1.11.5"
194
- # Since https://github.com/JuliaLang/julia/pull/57773 REPL.print_resons runs `display` on the backend
195
- # task. If this is called from the same thread the channel orchestration will block, so do this async.
196
- fetch (Threads. @spawn REPL. print_response (state. repl, response, true , true ))
197
- elseif VERSION >= v " 1.2.0-DEV.253"
198
- REPL. print_response (state. repl, response, true , true )
199
- else
200
- ok, result = response
201
- REPL. print_response (state. repl, ok ? result : result[1 ], ok ? nothing : result[2 ], true , true )
202
- end
209
+ print_response (state. repl, response, true , true )
203
210
println (state. terminal)
204
211
LineEdit. reset_state (s)
205
212
end
0 commit comments