mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-11-10 14:11:29 +08:00
parent
9532348bce
commit
d78a3cf865
1 changed files with 6 additions and 13 deletions
|
|
@ -68,13 +68,15 @@ defmodule LivebookCLI.Server do
|
||||||
)
|
)
|
||||||
|
|
||||||
:available ->
|
:available ->
|
||||||
case start_server() do
|
# We configure the endpoint with `server: true`,
|
||||||
:ok ->
|
# so it's gonna start listening
|
||||||
|
case Application.ensure_all_started(:livebook) do
|
||||||
|
{:ok, _} ->
|
||||||
open_from_options(LivebookWeb.Endpoint.access_url(), opts)
|
open_from_options(LivebookWeb.Endpoint.access_url(), opts)
|
||||||
Process.sleep(:infinity)
|
Process.sleep(:infinity)
|
||||||
|
|
||||||
:error ->
|
{:error, error} ->
|
||||||
print_error("Livebook failed to start")
|
print_error("Livebook failed to start with reason: #{inspect(error)}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -111,15 +113,6 @@ defmodule LivebookCLI.Server do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp start_server() do
|
|
||||||
# We configure the endpoint with `server: true`,
|
|
||||||
# so it's gonna start listening
|
|
||||||
case Application.ensure_all_started(:livebook) do
|
|
||||||
{:ok, _} -> :ok
|
|
||||||
{:error, _} -> :error
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp open_from_options(base_url, opts) do
|
defp open_from_options(base_url, opts) do
|
||||||
if opts[:open] do
|
if opts[:open] do
|
||||||
browser_open(base_url)
|
browser_open(base_url)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue