Skip to content

Commit dda4562

Browse files
committed
Refactor RubyVM initialization to require Bundler setup conditionally
1 parent 011f526 commit dda4562

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • packages/npm-packages/ruby-wasm-wasi/src

packages/npm-packages/ruby-wasm-wasi/src/vm.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,13 @@ export class RubyVM {
331331
initialize(args: string[] = ["ruby.wasm", "-EUTF-8", "-e_=0"]) {
332332
const c_args = args.map((arg) => arg + "\0");
333333
this.guest.rubyInit(c_args);
334-
try {
335-
this.eval(`
336-
# Ruby can expose Gem before rubygems.rb finishes setting up its API.
337-
# Load RubyGems explicitly so Bundler standalone does not see a partial Gem module.
338-
require "rubygems" if defined?(Gem) && !Gem.respond_to?(:ruby_api_version)
334+
try {
335+
this.eval(`
339336
# Require Bundler standalone setup
340337
if File.exist?("/bundle/bundler/setup.rb")
338+
# Ruby can expose Gem before rubygems.rb finishes setting up its API.
339+
# Load RubyGems explicitly so Bundler standalone does not see a partial Gem module.
340+
require "rubygems" if defined?(Gem) && !Gem.respond_to?(:ruby_api_version)
341341
require "/bundle/bundler/setup.rb"
342342
elsif File.exist?("/bundle/setup.rb")
343343
# For non-CM builds, which doesn't use Bundler's standalone mode

0 commit comments

Comments
 (0)