mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-08 20:46:16 +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
|
||||
# See https://hexdocs.pm/elixir/Application.html
|
||||
# for more information on OTP Applications
|
||||
@moduledoc false
|
||||
|
||||
use Application
|
||||
|
@ -216,21 +214,25 @@ defmodule Livebook.Application do
|
|||
|
||||
@doc false
|
||||
def start_iframe(port, {m, f, a}) do
|
||||
require Logger
|
||||
|
||||
case apply(m, f, a) do
|
||||
{:ok, pid} ->
|
||||
{:ok, pid}
|
||||
|
||||
{:error, {:shutdown, {_, _, {:listen_error, _, :eaddrinuse}}}} = error ->
|
||||
Logger.error(
|
||||
"Failed to start Livebook iframe server because port #{port} is already in use"
|
||||
)
|
||||
{:error, {:shutdown, {_, _, {{_, {:error, :eaddrinuse}}, _}}}} = error ->
|
||||
iframe_port_in_use(port)
|
||||
error
|
||||
|
||||
{:error, {:shutdown, {_, _, {:listen_error, _, :eaddrinuse}}}} = error ->
|
||||
iframe_port_in_use(port)
|
||||
error
|
||||
|
||||
{:error, _} = error ->
|
||||
error
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue