Module: Lookout::Jruby
- Defined in:
- lib/lookout/jruby.rb,
lib/lookout/jruby/version.rb,
lib/lookout/jruby/cleanup_tempfiles_17.rb,
lib/lookout/jruby/cleanup_tempfiles_9k.rb,
lib/lookout/jruby/cleanup_tempfiles_common.rb
Constant Summary collapse
- VERSION =
"2.4.0"
Class Method Summary collapse
-
.cleanup_tempfiles ⇒ Object
cleanup the jars copied to the temp directory when it gets added to the JRuby classloader.
-
.process_exists?(pid) ⇒ Boolean
stolen from process_exists gem github.com/wilsonsilva/process_exists/blob/master/lib/process_exists/core_ext/process.rb.
Class Method Details
.cleanup_tempfiles ⇒ Object
cleanup the jars copied to the temp directory when it gets added to the JRuby classloader. when killing jruby hard then those files remain there as the JVM does not clean them up.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/lookout/jruby/cleanup_tempfiles_common.rb', line 9 def cleanup_tempfiles Dir[File.join(ENV_JAVA['java.io.tmpdir'], 'jruby-*')].each do |dir| pid = File.basename(dir)[6..-1] unless process_exists?(pid) # do not use fileutils here as we are in jruby-core Dir[File.join(dir, '*')].each do |file| File.delete(file) rescue warn "could not delete #{file}" end Dir.delete(dir) rescue warn "could not delete #{dir}" end end end |
.process_exists?(pid) ⇒ Boolean
stolen from process_exists gem github.com/wilsonsilva/process_exists/blob/master/lib/process_exists/core_ext/process.rb
7 8 9 10 11 12 |
# File 'lib/lookout/jruby/cleanup_tempfiles_9k.rb', line 7 def process_exists?(pid) system("kill -0 #{pid} 2> /dev/null") rescue # i.e. windows false end |