Skip to content

ruby-packer sets BUNDLE_GEMFILE inside the running script #176

@d4rky-pl

Description

@d4rky-pl

I'm aware that this project is no longer actively maintained but I'm leaving this info here for the people still using it and googling answers:

When packaging the app, ruby-packer embeds BUNDLE_GEMFILE environment variable inside so it's visible to the script being packed and all the processes spawned by it.

This may trip you over if you try to run system("bundle") inside your code and you will see this error instead:

[!] There was an error parsing `Gemfile`: No such file or directory @ rb_sysopen - /__enclose_io_memfs__/local/Gemfile. Bundler cannot continue.

The workaround for this is to ENV.delete 'BUNDLE_GEMFILE' inside your script. If you still need to support this env var coming from the outside you can add if ENV['BUNDLE_GEMFILE'] == '/__enclose_io_memfs__/local/Gemfile' to ensure you're only clearing the default.

Also shout out to ericbeland/ruby-packer for a working Ruby 3.1 fork 👋

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions