ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
578 stars 241 forks source link

$(PROJECT)_sup is always included in the registered list of the app file #896

Closed emtenet closed 4 years ago

emtenet commented 4 years ago

When an app file is created from PROJECT_XXX variables and the PROJECT_MOD module exists, the registered key always includes $(PROJECT)_sup regardless of whether a $(PROJECT)_sup source file exists, or if it gets registered.

Defining the PROJECT_REGISTERED variable only adds names to the registered list, the $(PROJECT)_sup item cannot be removed.

Is there a best practice to register an application's top level supervisor that I am not aware of? I notice cowboy and ranch both register their top level supervisor, but only ranch references that registered name.

essen commented 4 years ago

Yes registering the top level supervisor makes it simpler to introspect the application from the shell.

You say you have an _app module but not a top-level supervisor? Could you clarify?

emtenet commented 4 years ago

Thanks for the quick dose of perspective Loïc.

Whilst simplifying an old app I reduced the supervision tree down to a single gen_server. My problem was that I went to far and removed the top level supervisor leaving a supervisor tree with no supervisors! Hence my confusion why erlang.mk was insisting on a registered supervisor in addition to my lone registered gen_server.

Sorry to take up your time, I will close this issue. Thanks, Michael.

essen commented 4 years ago

No worries. :-)