Include reason if we can't start Livebook, closes #703 (#705)

This commit is contained in:
José Valim 2021-11-12 14:36:02 +01:00 committed by GitHub
parent 9532348bce
commit d78a3cf865
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)