burrito icon indicating copy to clipboard operation
burrito copied to clipboard

Checking if an application is running under Burrito

Open ollien opened this issue 2 years ago • 1 comments

I want to be able to fetch arguments from my Application, regardless of if the application is being run from a burrito-based release or with mix. Ideally, I'd be able to do something like this

def get_args() do
  if Burrito.is_standalone?() do
    Burrito.Util.Args.get_argments()
  else
    System.argv()
  end
end

Is there a way to do this that I'm not seeing? If not, consider this issue a feature request :)

ollien avatar Jan 28 '24 16:01 ollien

I have the same issue as I support building with escript (which I use locally) and Burrito (which I intend for users).

I'm not aware of a built in way to do that so I currently solve this by passing an environment variable BUILD_MODE=[escript|burrito] to configure the project definition and how args are looked up.

mmower avatar Jan 30 '24 09:01 mmower

I'm thinking of passing an extra env variable into the erlang launcher environment, something like __BURRITO=1 -- would that suffice?

doawoo avatar Mar 02 '24 00:03 doawoo

I just released Burrito v1.0.3 to Hex! Now when a burrito app is launched, the environment variable __BURRITO will have the value 1. You can use this at runtime to check if your app is running inside burrito!

doawoo avatar Mar 03 '24 00:03 doawoo