How to check if Ruby script is running via Bundler

In a Ruby script, is there a way to check if the current process is running via Bundler, i.e. via bundle exec or binstub?

+3


source to share


1 answer


You can check defined?(Bundler)

, but it will also be present if you require 'bundler'

fail bundle exec

.

At startup, bundle exec

there are several variables inside ENV

that are not different. It is noteworthy that BUNDLE_GEMFILE

and BUNDLE_BIN_PATH

.



There are a few details in the Environment Modifications

bundle exec docs.

+5


source







All Articles