mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-09 13:07:37 +08:00
Match on more eaddrinuse patterns
This commit is contained in:
parent
40c945502f
commit
cfcd1cdc19
1 changed files with 10 additions and 8 deletions
|
@ -1,6 +1,4 @@
|
||||||
defmodule Livebook.Application do
|
defmodule Livebook.Application do
|
||||||
# See https://hexdocs.pm/elixir/Application.html
|
|
||||||
# for more information on OTP Applications
|
|
||||||
@moduledoc false
|
@moduledoc false
|
||||||
|
|
||||||
use Application
|
use Application
|
||||||
|
@ -216,21 +214,25 @@ defmodule Livebook.Application do
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
def start_iframe(port, {m, f, a}) do
|
def start_iframe(port, {m, f, a}) do
|
||||||
require Logger
|
|
||||||
|
|
||||||
case apply(m, f, a) do
|
case apply(m, f, a) do
|
||||||
{:ok, pid} ->
|
{:ok, pid} ->
|
||||||
{:ok, pid}
|
{:ok, pid}
|
||||||
|
|
||||||
{:error, {:shutdown, {_, _, {:listen_error, _, :eaddrinuse}}}} = error ->
|
{:error, {:shutdown, {_, _, {{_, {:error, :eaddrinuse}}, _}}}} = error ->
|
||||||
Logger.error(
|
iframe_port_in_use(port)
|
||||||
"Failed to start Livebook iframe server because port #{port} is already in use"
|
error
|
||||||
)
|
|
||||||
|
|
||||||
|
{:error, {:shutdown, {_, _, {:listen_error, _, :eaddrinuse}}}} = error ->
|
||||||
|
iframe_port_in_use(port)
|
||||||
error
|
error
|
||||||
|
|
||||||
{:error, _} = error ->
|
{:error, _} = error ->
|
||||||
error
|
error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp iframe_port_in_use(port) do
|
||||||
|
require Logger
|
||||||
|
Logger.error("Failed to start Livebook iframe server because port #{port} is already in use")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue