Direct non-captured output to the terminal (#273)

This commit is contained in:
Jonatan Kłosko 2021-05-16 17:07:19 +02:00 committed by GitHub
parent 61a841a6d2
commit 38db12fbcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View file

@ -55,7 +55,10 @@ defmodule Livebook.Runtime.ElixirStandalone do
defp start_elixir_node(elixir_path, node_name, eval, argv) do
# Here we create a port to start the system process in a non-blocking way.
Port.open({:spawn_executable, elixir_path}, [
:binary,
# We don't communicate with the system process via stdio,
# contrarily, we want any non-captured output to go directly
# to the terminal
:nouse_stdio,
:hide,
args: elixir_flags(node_name) ++ ["--eval", eval, "--" | Enum.map(argv, &to_string/1)]
])

View file

@ -90,8 +90,10 @@ defmodule Livebook.Runtime.MixStandalone do
defp start_elixir_mix_node(elixir_path, node_name, eval, argv, project_path) do
# Here we create a port to start the system process in a non-blocking way.
Port.open({:spawn_executable, elixir_path}, [
:binary,
:stderr_to_stdout,
# We don't communicate with the system process via stdio,
# contrarily, we want any non-captured output to go directly
# to the terminal
:nouse_stdio,
:hide,
cd: project_path,
args:

View file

@ -39,7 +39,9 @@ defmodule Livebook.Runtime.StandaloneInit do
# Minimize schedulers busy wait threshold,
# so that they go to sleep immediately after evaluation.
# Enable ANSI escape codes as we handle them with HTML.
"+sbwt none +sbwtdcpu none +sbwtdio none -elixir ansi_enabled true",
# Disable stdin, so that the system process never tries to read
# any input from the terminal.
"+sbwt none +sbwtdcpu none +sbwtdio none -elixir ansi_enabled true -noinput",
# Make the node hidden, so it doesn't automatically join the cluster
"--hidden",
# Use the cookie in Livebook