From 81d803d5644e081d03962665898d4af62e2e4ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Mon, 29 Apr 2024 16:43:00 +0200 Subject: [PATCH] Explicitly halt standalone runtime (#2587) --- lib/livebook/runtime/standalone_init.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/livebook/runtime/standalone_init.ex b/lib/livebook/runtime/standalone_init.ex index 294f527a9..a49a210e9 100644 --- a/lib/livebook/runtime/standalone_init.ex +++ b/lib/livebook/runtime/standalone_init.ex @@ -116,6 +116,9 @@ defmodule Livebook.Runtime.StandaloneInit do # Note Windows does not handle escaped quotes and newlines the same way as Unix, # so the string cannot have constructs newlines nor strings. That's why we pass # the parent node name as ARGV and write the code avoiding newlines. + # + # Also note that we explicitly halt, just in case `System.no_halt(true)` is + # called within the runtime. @child_node_eval_string """ [parent_node] = System.argv();\ init_ref = make_ref();\ @@ -126,7 +129,8 @@ defmodule Livebook.Runtime.StandaloneInit do receive do {:DOWN, ^manager_ref, :process, _object, _reason} -> :ok end;\ after 10_000 ->\ :timeout;\ - end\ + end;\ + System.halt()\ """ if @child_node_eval_string =~ "\n" do