Skip to content

Commit

Permalink
Use System.no_halt(true)
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed Jul 25, 2022
1 parent 90ab1f5 commit 8e5dfd3
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 23 deletions.
6 changes: 1 addition & 5 deletions bandit.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@ bandit = {Bandit, plug: Router, scheme: :http, port: 4000}
require Logger
Logger.info("starting #{inspect(bandit)}")
{:ok, _} = Supervisor.start_link([bandit], strategy: :one_for_one)

# unless running from IEx, sleep idenfinitely so we can serve requests
unless IEx.started?() do
Process.sleep(:infinity)
end
System.no_halt(true)
2 changes: 1 addition & 1 deletion exshome.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Application.put_all_env(

Calendar.put_time_zone_database(Tz.TimeZoneDatabase)

System.no_halt(true)
Mix.install([{:exshome, "0.1.7"}])

{:ok, _} = Application.ensure_all_started(:exshome)
System.no_halt(true)
6 changes: 1 addition & 5 deletions gen_stage.exs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,4 @@ defmodule Main do
end

Main.main()

# Unless running from IEx, sleep indefinitely so stages keep running
unless IEx.started?() do
Process.sleep(:infinity)
end
System.no_halt(true)
2 changes: 1 addition & 1 deletion phoenix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ defmodule SamplePhoenix.Endpoint do
end

{:ok, _} = Supervisor.start_link([SamplePhoenix.Endpoint], strategy: :one_for_one)
Process.sleep(:infinity)
System.no_halt(true)
2 changes: 1 addition & 1 deletion phoenix_live_view.exs
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ defmodule SamplePhoenix.Endpoint do
end

{:ok, _} = Supervisor.start_link([SamplePhoenix.Endpoint], strategy: :one_for_one)
Process.sleep(:infinity)
System.no_halt(true)
6 changes: 1 addition & 5 deletions plug_cowboy.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@ plug_cowboy = {Plug.Cowboy, plug: Router, scheme: :http, port: 4000}
require Logger
Logger.info("starting #{inspect(plug_cowboy)}")
{:ok, _} = Supervisor.start_link([plug_cowboy], strategy: :one_for_one)

# unless running from IEx, sleep idenfinitely so we can serve requests
unless IEx.started?() do
Process.sleep(:infinity)
end
System.no_halt(true)
6 changes: 1 addition & 5 deletions scenic.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ defmodule Main do
]

{:ok, _} = Supervisor.start_link(children, strategy: :one_for_one)

# unless running from IEx, sleep idenfinitely so the GUI keeps running
unless IEx.started?() do
Process.sleep(:infinity)
end
end
end

Expand Down Expand Up @@ -74,3 +69,4 @@ defmodule Example.Scene.Home do
end

Main.main()
System.no_halt(true)

0 comments on commit 8e5dfd3

Please sign in to comment.