Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Shell out instead of creating new JRuby runtimes in our integs
Browse files Browse the repository at this point in the history
This avoids leaving extra runtimes around that just consume memory
during our integration tests, sometimes leading to OutOfMemory
situations.
  • Loading branch information
bbrowning committed Jun 16, 2016
1 parent 44f9f81 commit 6f19f9e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions integration-tests/spec/spec_helper.rb
Expand Up @@ -138,13 +138,18 @@ def wildfly_server
end

def eval_in_new_ruby(script)
ruby = org.jruby.Ruby.new_instance
unless ENV['DEBUG']
dev_null = PLATFORM =~ /mswin/ ? 'NUL' : '/dev/null'
ruby.evalScriptlet("$stdout = File.open('#{dev_null}', 'w')")
tmpdir = Dir.mktmpdir("tmptorqueboxeval", ".")
script_path = "#{tmpdir}/script.rb"
begin
File.open(script_path, "w") { |f| f.write(script) }
command = %Q(#{jruby_command} #{jruby_jvm_opts} "#{script_path}" 2>&1)
output = `#{command}`
if ENV['DEBUG']
puts output
end
ensure
FileUtils.rm_rf(tmpdir)
end
ruby.evalScriptlet(script)
ruby.tearDown(false)
end

ALREADY_BUNDLED = []
Expand Down

0 comments on commit 6f19f9e

Please sign in to comment.