summaryrefslogtreecommitdiff
path: root/cli/tools/jupyter/server.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-09-28 16:51:44 +0200
committerGitHub <noreply@github.com>2023-09-28 16:51:44 +0200
commit0bd53fd52d8937afed401fe1c61bb2ba0b23501c (patch)
tree4bba498372accf7fc0a3d2fca7ea3f99329f8f1f /cli/tools/jupyter/server.rs
parent35fad4d2bc022b7053b5390ec1fb47ca28f4086e (diff)
fix(jupyter): more robust Deno.jupyter namespace (#20710)
Diffstat (limited to 'cli/tools/jupyter/server.rs')
-rw-r--r--cli/tools/jupyter/server.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/cli/tools/jupyter/server.rs b/cli/tools/jupyter/server.rs
index c54dcd275..2489fcd04 100644
--- a/cli/tools/jupyter/server.rs
+++ b/cli/tools/jupyter/server.rs
@@ -391,15 +391,18 @@ impl JupyterServer {
let output =
get_jupyter_display_or_eval_value(&mut self.repl_session, &result)
.await?;
- msg
- .new_message("execute_result")
- .with_content(json!({
- "execution_count": self.execution_count,
- "data": output,
- "metadata": {},
- }))
- .send(&mut *self.iopub_socket.lock().await)
- .await?;
+ // Don't bother sending `execute_result` reply if the MIME bundle is empty
+ if !output.is_empty() {
+ msg
+ .new_message("execute_result")
+ .with_content(json!({
+ "execution_count": self.execution_count,
+ "data": output,
+ "metadata": {},
+ }))
+ .send(&mut *self.iopub_socket.lock().await)
+ .await?;
+ }
msg
.new_reply()
.with_content(json!({