From: headius@... Date: 2020-03-31T17:46:04+00:00 Subject: [ruby-core:97647] [Ruby master Feature#16744] Flag to load current bundle without using bundle exec Issue #16744 has been updated by headius (Charles Nutter). I understand your comment on my issue better now that we discussed it... It does appear that Bundler added in the past few years the ability to detect that the `bundle exec` target is a Ruby script with an appropriate shebang, where appropriate is one of: * `env` with "ruby", "jruby", or "truffleruby" * Exact match to `RbConfig.ruby` output If the target script has a matching shebang, it will be executed in-process. So you are correct, in the cases where the target script has a matching shebang, it will not double-launch. This may be the large majority of cases. However it still double-launches in any case where there's no shebang or it doesn't match. Perhaps we need a way to force this behavior, like `bundle ruby mycommand`? I suppose the other remaininig benefit of `-G` is that it's shorter than `-rbundle/setup` if you want to put it in the `RUBYOPT` environment variable. ---------------------------------------- Feature #16744: Flag to load current bundle without using bundle exec https://bugs.ruby-lang.org/issues/16744#change-84846 * Author: headius (Charles Nutter) * Status: Open * Priority: Normal ---------------------------------------- The `bundle exec` command is used by Ruby users primarily to start up a Ruby command or application with only its specific locked dependencies wired up. Unfortunately to do this it currently double-launches, executing a second Ruby command and doubling the base startup time for these use cases. With Bundler becoming part of the standard library, it seems a good time to add support for doing what `bundle exec` does without requiring a relaunch. For many years, JRuby has implemented the `-G`/`--gemfile` flag which requires in `bundler/setup` before user code starts, eliminating the need to bundle exec in these situations. https://github.com/jruby/jruby/commit/ea0eed02b4eb57c2198afa9fd47f94bc46cfc69f This is based on the same flags in Rubinius: https://github.com/rubinius/rubinius/commit/edc94f2e3a61d8c94031a942b2024c6c5aa3ea94 There's at least one more commit later on in Rubinius that fixes some interations between `-G` and `-S`. Obviously this does not eliminate `bundle exec` use cases where the target command is not a Ruby command, but that is a very specific (and rather strange to me) feature. The majority of use cases are booting up a Ruby command, for which this implementation of `-G` would be sufficient (I think). There may be different or additional ways that `bundle exec` attempts to isolate the subcommand's environment and dependencies, but I believe requiring `bundler/setup` at boot comes pretty close. See also this bug report where I suggest using JRuby's embedding APIs to do `bundle exec`. We very much want to help eliminate this double-launching, one way or another. https://github.com/rubygems/rubygems/issues/3246 -- https://bugs.ruby-lang.org/ Unsubscribe: