Skip to content

Commit

Permalink
Show which port is in use when startup fails (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko authored Feb 23, 2024
1 parent 860fa45 commit 57520c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/bandit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ defmodule Bandit do
{:ok, pid}

{:error, {:shutdown, {:failed_to_start_child, :listener, :eaddrinuse}}} = error ->
Logger.error([info(scheme, display_plug, nil), " failed, port already in use"])
Logger.error([info(scheme, display_plug, nil), " failed, port #{port} already in use"])
error

{:error, _} = error ->
Expand Down
2 changes: 1 addition & 1 deletion test/bandit/server_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule ServerTest do
end)

assert logs =~
"Running ServerTest with Bandit #{Application.spec(:bandit)[:vsn]} at http failed, port already in use"
"Running ServerTest with Bandit #{Application.spec(:bandit)[:vsn]} at http failed, port #{port} already in use"
end

test "can run multiple instances of Bandit" do
Expand Down

0 comments on commit 57520c7

Please sign in to comment.