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