Mix.Task.run("app.config") prevents mix task code from being loaded

On Elixir 1.15, calling Mix.Task.run("app.config") prevents calling other modules from my tool.

The tool is installed globally with mix archive.install --force.

In my task run/1 callback, if I call some other module before app.config is called, then the module is loaded in memory and stays available. But if the app.config call happens before, then the module cannot be found.

It looks like app.config erases the load path or something like that.

It worked correctly on Elixir 1.14.

(On a side note I realized that I do not need that code anymore, since the config for the tool is defined in mix.exs ^^’ )

Trying back on Elixir 1.14 and the task does not work without running app.config (could not load modules from :my_app, Are you in a mix project?).

Is there some change in this behaviour for Elixir 1.15? I am not sure when reading the changelog.

Edit: hmmm it seems that app.config is always required even in Elixir 1.15, I don’t know what happened before. But I still have that bug where the code of the globally installed task is not available anymore after app.config.

I have this workaround for now:

    {__MODULE__, _, cpath} = :code.get_object_code(__MODULE__)
    dir = Path.dirname(cpath)