Sha256: 056d93acd8434b52dff0a3d59417787c3c40cf16de8f31401d07f70a5e04c787

Contents?: true

Size: 768 Bytes

Versions: 2

Compression:

Stored size: 768 Bytes

Contents

module Lookout
  module Jruby

    class << self
      # 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.
      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lookout-jruby-2.4.0 lib/lookout/jruby/cleanup_tempfiles_common.rb
lookout-jruby-2.3.0 lib/lookout/jruby/cleanup_tempfiles_common.rb