Skip to content

Commit c17a55b

Browse files
committed
Attempt to send stdio to the kernel before sending execute_reply
The Jupyter messaging docs state that all messages on the shell (request) channel shall be ended with a `status: idle` message, and that: "This idle status message indicates that IOPub messages associated with a given request have all been received." Previously we did not attempt to ensure this, which meant that in some cases the `execute_result` message would be published after the `execute_reply` message had been sent. It's still not exactly guaranteed by the `yield()`, but it's something and it makes the `jupyter_kernel_test` tests pass.
1 parent 4343060 commit c17a55b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/execute_request.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ function execute_request(socket, kernel, msg)
108108

109109
# flush pending stdio
110110
flush_all()
111+
yield()
112+
if haskey(kernel.bufs, "stdout")
113+
send_stdout(kernel)
114+
end
115+
if haskey(kernel.bufs, "stderr")
116+
send_stderr(kernel)
117+
end
111118

112119
undisplay(result, kernel) # dequeue if needed, since we display result in pyout
113120
@invokelatest display(kernel) # flush pending display requests

0 commit comments

Comments
 (0)